From patchwork Wed Nov 22 08:06:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10069889 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BD17460353 for ; Wed, 22 Nov 2017 08:07:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE9D128236 for ; Wed, 22 Nov 2017 08:07:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1C88294EC; Wed, 22 Nov 2017 08:07:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 34FA628236 for ; Wed, 22 Nov 2017 08:07:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0F0E89E35; Wed, 22 Nov 2017 08:07:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 8048 seconds by postgrey-1.35 at gabe; Wed, 22 Nov 2017 08:07:29 UTC Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0054.outbound.protection.outlook.com [104.47.32.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9FBEE89E35; Wed, 22 Nov 2017 08:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=WUoszxfvDdFibH3OrGKILAi0N+3IxxXdbT9io2LaICo=; b=0LA2JdVvYu+ARMdhhDaeZbkYLDEg3m7qeNm+8tzwl3181hrUcPVCoNtTPiSP9p8agtUR+MqZwV4Wm/7+sE3DJM6NdIMLVXVsykxqYgn7MhyDVTRD/GYIUjNgZge+kR48Wlko5D01pJcboOTJqlLqW8NqLpvqj9lcpxFqXlHbx3Y= Received: from MWHPR12CA0050.namprd12.prod.outlook.com (10.175.47.140) by DM5PR12MB1274.namprd12.prod.outlook.com (10.168.237.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Wed, 22 Nov 2017 08:07:27 +0000 Received: from DM3NAM03FT014.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::209) by MWHPR12CA0050.outlook.office365.com (2603:10b6:300:103::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Wed, 22 Nov 2017 08:07:27 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by DM3NAM03FT014.mail.protection.outlook.com (10.152.82.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.239.4 via Frontend Transport; Wed, 22 Nov 2017 08:07:27 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.361.1; Wed, 22 Nov 2017 02:07:26 -0600 From: Roger He To: , Subject: [PATCH 3/5] drm/ttm: add page order support in ttm_pages_put Date: Wed, 22 Nov 2017 16:06:35 +0800 Message-ID: <1511337997-26698-3-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511337997-26698-1-git-send-email-Hongbo.He@amd.com> References: <1511337997-26698-1-git-send-email-Hongbo.He@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(2980300002)(428002)(189002)(199003)(36756003)(72206003)(478600001)(316002)(53416004)(16586007)(110136005)(97736004)(54906003)(2906002)(8936002)(68736007)(189998001)(50226002)(2950100002)(48376002)(101416001)(53936002)(81156014)(8676002)(76176999)(105586002)(6666003)(50466002)(81166006)(50986999)(5660300001)(86362001)(575784001)(47776003)(4326008)(106466001)(5003940100001)(356003)(450100002)(305945005)(77096006)(104016004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1274; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT014; 1:2fUbLUD8rIDwry9dzuLx28r6IU6aLgRIyCkqGLqogvV1ieqkrJ6fFyOgLIVzCkFoMhBjiEEQ8C3onM9zSRqvHH3F3Wo6JFYylDan5uME3aMKhqcA1rbQjTD9J69l1hjZ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 192f95fd-1c2b-4081-c009-08d531801242 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:DM5PR12MB1274; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1274; 3:rNpVvnC8jpNg3i6riN9Uwb/Q3fMpnIDFhaZMtN6HE5F84EIkaNBdSMAPHV5K5v+o+2u4u/XbUwLsclEvBYASeDSQEABkmCSJ2JLxjZuDlUMXwkoMDpImrFQT6IkW+v19yyylc6bL8dlBRZavMslGyDzjbV0H1PtyaERFWkzQ+cUAzlDgXEC2QjM7bQ51QQubbd4E3u3EZa+1seIZFrIrVio9lqTjIe1cGoNYsDEW2kfVMRJYHQWp2rYHW0dqQukJpk009j5ZQqjhOcb/wGqxViLEaD4xROPAzbuqtBQvs6nDa3pdFdOk75M/aQENAzbSY0j+FCnDGGogSAnldmPC6lYYShiHSBRo2piZq/6Ki68=; 25:utAlG/zVHNCgPW95eHlPaKSPKHPACFLsvjfK5JZCD7Yz4mXqyJ9e6Z/Uvvrup6ZyB8PHW3FRY45KrMrHDFwv0Yk2s/5fAqnUxR/WkI87nlG9PimtqcnEALOv6yK6KfTZJ4aXDsi2ZS2xGgURClO98Yg5AZFeLbscSqZCfgcos9miKCjukADMDLk8MrCDxmwW+51tknZlYPWeghiYqtQY4jbekdlHP82BlRLCQwqhmXY6yXkoMAsA2maWA9bJDSXx6rIOriNGkVBmOTuhEpXIzl0I0hg8gLWxrMwdo68vC5b2IaPpCYuocEbz+sF91RxQTquT88KkhX/LSt+J2oJtAg== X-MS-TrafficTypeDiagnostic: DM5PR12MB1274: X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1274; 31:LoII6todzFLpx1YxXmwoyu6lKqJHgnz5kO1CAhrUNe+bnRS6jc01O30bdAfhohS/99w0iUsMGaeNOtBmpGoO1T6eBok7zpGV7o2f61BPD4sTMyouN4q7IxKiRR4WmtJR1dPE+VngIJbhQ1pOl3izjo5DGKr7rauY5n+P7DKG1i5du428r8MCMcEf0qX/bJW449TdMDLHK+BAodsTviWhWPXbmrGEfdyJxqKkQw7tokI=; 20:osrt7sbNXijMlf0JTsmzgUbxbPGyv3RxziygpK+MHjP19T/rEiGbXlEmR2r6GG6GqcEVd00WQspBFOBq1mObNXI2KXM4Qgtj5jzUMk7/qvrHwAn5lX4l8HDD8zTCrFhH8T3A8CFubH6K7WGuK8/5CyA4vlAaVgXLVfSHz6ZE1nuzkYNp3CczCcwGwaWvTwxU8NnZSHs38q8R4FbnalvP8fuE+1077ouYMt+rKiOLP9MYweg/XalcMQc0IPHGfQNEueQdjIXoliuGCzOH7rdlyqwBnueXA0W0Py6UL6I8nKw/T54Eur/y0VsAsQJUDHtJUl/4xTem0r1mxjco6a+9NEInMQxDx45/S2Ui4xxgb3S/HbBjUXUCCpNPFJnl0AMUEYT8pJjxdttyjQgoauwhiUoQB3MaJSZO6H9TzkWGRjy/APQ7TepOyw0hRJ+C8agiDP6KAV7CEoHPTRkHyeNSyD9a8988eXgXyuKI6y9xCiChLvJdNAZVhgCLwl+e7svq X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3231022)(3002001)(10201501046)(93006095)(93003095)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(20161123555025)(20161123560025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR12MB1274; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR12MB1274; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1274; 4:/LgsPxBTas3Rdll4DGV1AMUdnKkQujg9xFa6dLv/2RVdj53CQYOJN2tWNf9qMw6wNPRhXpMzwmlLdIYEAuuiDKWWm9Br9+Mrvla1PBe/bnfkO1FHTHgaQrWlvZ/XuTSFTH6uixI9uX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EYCe/hxpfoJ+eYVHZadsb/AP/RXQu7Vzvj1FFClnsH64XdlULBEg=; 24:EU66i8EzT8zUXabgJS49cJnHtfA3zA0gz7mSwyLlnVlrWNACO5Bs2+caRiEvlWsnEAmUPBycgdU86Bj4YmT42HGNJd2n+Dmfp+1WwcUvSv0=; 7:k4aBbETKEyC9lKfTAM2zf7O+kL/mZsxkPv9EdZmnbA5hAbnEYsetgYdLBq2KFc69Y5BY0X4+64rDAtP5VH0SENMO4o0Btww8Y5QIJ8WGoB5ykrcRqRpfS5ZvM6uUO+W5klm2Wf7r9XiMunmRnyY2yMfX9UxeB7qJOH3czUGjp9e1j1q68tUSGEwOSwYXMSTUMALuV6HiwpmrInR3YD7jZUIen2nxL1HmQW0eIvGWSIaqMIHa1ouh7ux47rQZZGYT SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1274; 20:VP+PG9tF9DzewpepDtBY2eBzZs6wmu2LMGyYAQAROgTArvuANAG79AAh9eU9I7lNtgqhUb6XefzGxo5clRuogavsiesedA1Py6oWipu8JNTMSAPY9Ep3CCjrJe5QNlTqVLBuMZpSI4ep4lCWekdyB8Lt+QviSK7cT0O1CkU12wNWYui23DYTHv7zWS0AsTOt6Jf5AiPwySmbtN4r5hYxnO6jggPAgFjnn/RpOOx8E5VtT7VeOcclxwdGcUDyJIU1 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2017 08:07:27.3482 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 192f95fd-1c2b-4081-c009-08d531801242 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1274 Cc: Roger He , Christian.Koenig@amd.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Change-Id: Ia55b206d95812c5afcfd6cec29f580758d1f50f0 Signed-off-by: Roger He --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index fabb082..343db0b 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -299,13 +299,16 @@ static struct ttm_page_pool *ttm_get_pool(int flags, bool huge, } /* set memory back to wb and free the pages. */ -static void ttm_pages_put(struct page *pages[], unsigned npages) +static void ttm_pages_put(struct page *pages[], unsigned npages, + unsigned int order) { - unsigned i; - if (set_pages_array_wb(pages, npages)) - pr_err("Failed to set %d pages to wb!\n", npages); - for (i = 0; i < npages; ++i) - __free_page(pages[i]); + unsigned int i, pages_nr = (1 << order); + + for (i = 0; i < npages; ++i) { + if (set_pages_wb(pages[i], pages_nr)) + pr_err("Failed to set %d pages to wb!\n", pages_nr); + __free_pages(pages[i], order); + } } static void ttm_pool_update_free_locked(struct ttm_page_pool *pool, @@ -368,7 +371,7 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, */ spin_unlock_irqrestore(&pool->lock, irq_flags); - ttm_pages_put(pages_to_free, freed_pages); + ttm_pages_put(pages_to_free, freed_pages, pool->order); if (likely(nr_free != FREE_ALL_PAGES)) nr_free -= freed_pages; @@ -403,7 +406,7 @@ static int ttm_page_pool_free(struct ttm_page_pool *pool, unsigned nr_free, spin_unlock_irqrestore(&pool->lock, irq_flags); if (freed_pages) - ttm_pages_put(pages_to_free, freed_pages); + ttm_pages_put(pages_to_free, freed_pages, pool->order); out: if (pages_to_free != static_buf) kfree(pages_to_free);