From patchwork Wed Nov 22 09:17:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10069975 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 8962760375 for ; Wed, 22 Nov 2017 09:51:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FBD529C1B for ; Wed, 22 Nov 2017 09:51:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 737C329C3C; Wed, 22 Nov 2017 09:51:18 +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 F0BCD29C1B for ; Wed, 22 Nov 2017 09:51:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35E596E619; Wed, 22 Nov 2017 09:51:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0076.outbound.protection.outlook.com [104.47.41.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id 526756E619 for ; Wed, 22 Nov 2017 09:51:15 +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=yH0arIwiFqwFIqh7on7bby1PhGnIzRE8BATGse8dXFk=; b=p7UGqBtfYAnpOFqjBi2qPJ3FzpbiRB7NnDpaMDSOmbYV2tRfWivuCnv+jKOGl2xqxnfPax5gdjjeMD4I5uIex1SLmfCxXQQSz9E80O39SzR9zGJutkHh4MMOijklhp86N8zljme74+ko7NQg6PCcso32cfbioRRKgyGYJnzUt+o= Received: from MWHPR1201CA0017.namprd12.prod.outlook.com (10.174.253.27) by DM5PR12MB1451.namprd12.prod.outlook.com (10.172.38.140) 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 09:18:16 +0000 Received: from CO1NAM03FT036.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by MWHPR1201CA0017.outlook.office365.com (2603:10b6:301:4a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Wed, 22 Nov 2017 09:18:15 +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 CO1NAM03FT036.mail.protection.outlook.com (10.152.80.181) 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 09:18:14 +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 03:18:13 -0600 From: Roger He To: , Subject: [PATCH 3/5] drm/ttm: add page order support in ttm_pages_put Date: Wed, 22 Nov 2017 17:17:12 +0800 Message-ID: <1511342234-18570-3-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511342234-18570-1-git-send-email-Hongbo.He@amd.com> References: <1511342234-18570-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)(376002)(346002)(39860400002)(2980300002)(428002)(189002)(199003)(81156014)(81166006)(36756003)(8676002)(2950100002)(110136005)(316002)(76176999)(16586007)(50986999)(356003)(104016004)(47776003)(2906002)(305945005)(8936002)(5660300001)(72206003)(478600001)(53936002)(450100002)(5003940100001)(189998001)(86362001)(50226002)(101416001)(4326008)(68736007)(50466002)(48376002)(97736004)(53416004)(105586002)(106466001)(77096006); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1451; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT036; 1:gZo3rbGHHaDJwOlez0ciYeOfG48ol8VknVUxdDnAIbyyvTXkYBp5/1U3r4CaoE33rj1TYnh4hqIEH4Rq/pYRWAxQjna2+xg4NpZujVtNMiiQVDSz5w8D0cBbiV7vxxhV X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d51afc5-5fdc-4da3-d780-08d53189f601 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600022)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:DM5PR12MB1451; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1451; 3:NMJE7kFvhraXRa+lLkN4UapSCvFpSshMHDKRk8ILMLR2nwI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k5TKqzsU+/zrQk0YbI0JCRg2YwvbKF7DCixm5m45TdH/BQuC8cojzPH9cj+YpyyZQ2FlC2GSBRsEouffPmNXmX/gAmt4cBmtVw8jBlIbMMvXZmpkTaWth5BIieLQGql5eArAlc6lO6zj8j5yZFguSF3hs4fWVlobX39OTf4qz5xNtTtHMKR23Cw4aUVpEklyHCQ4avAh6ZSY7KkcQbzSimlrqoqDrqZlUIEKgiEK9xnM1RZXrNFrzn58fM15Y8yVx29kVDjvz5L/fJ+5da/vToosORDyo8yttJ1LwGkunYBJDPBUMDS8XdP0hBsActsQ2FwhGZ6a9lmsaHN9ZckMhF3xtlqDGRuJVzU8yokqA/USwnRy1H5YDu4DAFDt/XeLLDISz52emB6Z6CgxEJCLRgid 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)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(93006095)(93003095)(10201501046)(3231022)(6055026)(6041248)(20161123560025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR12MB1451; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR12MB1451; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1451; 4:hWPL5FWZibSgrDMpCgyr/RpXY0zGRlbGWL8a5OLwqGumk8mPA7Uew5+VuyETqcbtDvF0QqUxFcKnVpd7Zels2Ew6eOnfzdd/T5uu2EIQ54GSDBAgP7KaEX2wkZ1B91Tn6H/kM+5cGXh2IyolRQuwZsakWJNWqT8AZLbOKy9C6A74fXZmrhBR07MLJCSbML1Cynnj0bLApWPMVq71zvvTv3Ew9DuTbBoj2Xlul7Z5M9kD71G9LaL/g6bkSEQfUrUq2Dwsa8sgHSU0wfTaslmAvaVDwM6fHlypY7snmZEQE7mrcJb/fWfm/onOPVQf2Q6R X-Forefront-PRVS: 0499DAF22A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB1451; 23:jIfg5cd4xfEQuzEmqAERnOxgqysC4vjM4oS2lSZdF?= =?us-ascii?Q?XabT13DanK3lHw7typkY74ioz6bcDcwRc8un+e7NYk8Jt+P5nCWW7e770/+8?= =?us-ascii?Q?BWbAdkZS60DJKh4AnGlAHflV0KMLczkxytF+WcA0lBC7Ho/55qy2eMEAGhgW?= =?us-ascii?Q?VkR0XqZk7UdYWoKnQk5zpV5fGZsR1Mjg6ExmZG16tUYW/l4AIuEskRI8wFal?= =?us-ascii?Q?chk6a7SGrmO2UYxBMPdCKLaNxC1yGB5ruL5P2nb1ST5ys5aLs+HlKzM6R5uV?= =?us-ascii?Q?VTmLKd+crRhow+kn6aEzmjALWco+INq1JLSZlE7RExShdySmXtHZ57whPJK9?= =?us-ascii?Q?rWdEvaKSqwZzEvfVi6GuUtpG2/ECZQaErQFg+Z4wI1q3GSIZc3x9qlgAgjeG?= =?us-ascii?Q?Lwoy8YbRmeehe5bbXGUN3IR+ThKbPy9eNkY7ol+jY9DA2O4fu0z34cmYBLbf?= =?us-ascii?Q?iAhUyOzn8sQ8MW/yEBOOHAyYtPlBZNSFPauCqQZ2ATsH9WwDx8XFuIgywdtV?= =?us-ascii?Q?TIvu6VSKK/JSlkpILCWALJPe0xfxYZ+yuTI+ii88/R3a6CSCQIbR5wCiqcak?= =?us-ascii?Q?OmKugxKF9go/23RP42h3gWap8DT3q97bBpEm9qyNTS9hXiSmUuHjxskYFthw?= =?us-ascii?Q?c5act0Lc3C3ihV7ZgDxGAcmcQ0HrNNM/R37nHLJbWEQc/eJJKZ9WPE7hWKij?= =?us-ascii?Q?54PVVX3Mf1rXBGYvsI86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sQlrLdJUwIlKRILk=; 7:4GyyPChOPNaSrTTkpesgRM+K6vhe30oRYdcVvzy+3psauW5VHK6Fm/F+16+0KSP7CJKfpyNAV7BozvjoBDgjTChqmbfcpvsiHJp9rrc61mmGhNCpI1sl+Ush2ny0QT+5nwIrAM9jF8kLJHf3HCnmIyW0zRh/d71QgbOtj8ZmzjRerqU4H7MHnYPGShQybeG1JWmuoAYKIw1/hzzbzT6w09lIgi46IRg5IqhtWExQWpqG2JYOrh+Pc6OQho2wy72D SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1451; 20:3e+mjbWb+tmJ2dYrbQvfS5XsT9T+ln1nyDbNROf54sUdSs0vNcHCt8Ep9wjLKzSsdyn+3KjagFpoqvlEAOOlj8+WyAQS8KZ0MV1oeVyBIprm1xUjEbNrbQgSxzIh4vtAkwY1PCSYGnksTidZqF3jsKlExdPtgJ+1R8CYdNxPhexcWfhIOgS6KQamYM+7eq+AvsQtNeobv23udGRv60qDji/giC64dGXrt/lCkF5q6+IR7eHnkqkyEpDpisT90Bf/ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2017 09:18:14.8358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d51afc5-5fdc-4da3-d780-08d53189f601 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: DM5PR12MB1451 Cc: Roger He 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 9b48b93..2dc83c0 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);