From patchwork Wed Nov 22 08:06:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10069891 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 082D960353 for ; Wed, 22 Nov 2017 08:08:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF33928236 for ; Wed, 22 Nov 2017 08:08:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2CFA294EC; Wed, 22 Nov 2017 08:08:06 +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 7F5DC28236 for ; Wed, 22 Nov 2017 08:08:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DDAAB6E5E0; Wed, 22 Nov 2017 08:08:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 80343 seconds by postgrey-1.35 at gabe; Wed, 22 Nov 2017 08:08:03 UTC Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0052.outbound.protection.outlook.com [104.47.36.52]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C49A6E5E0; Wed, 22 Nov 2017 08:08:03 +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=gBM9v0CeLGVsf9VKEiuwMXlEj86/n6f1E3TdcSMd8ZI=; b=kZtxcz1o6yWjENgMmuhXchBOI1dP0zP8SKrabm2Jd/BpO8KSnd67mcMnT5FvEsSzTybz30k6+JAEpebslyxUMCRN5ZKm5Mmp84Pqu54vSWLXyTku6QuyrMlydP4sOB0QxWBuaEbwfWvDSGXMS0LwR/lVnrvYKTNt5rFsaDmG0UU= Received: from DM5PR12CA0072.namprd12.prod.outlook.com (10.175.83.162) by BN6PR1201MB0051.namprd12.prod.outlook.com (10.174.114.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Wed, 22 Nov 2017 08:08:02 +0000 Received: from DM3NAM03FT045.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::207) by DM5PR12CA0072.outlook.office365.com (2603:10b6:3:103::34) 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 08:08:02 +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 DM3NAM03FT045.mail.protection.outlook.com (10.152.82.208) 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:08:01 +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:08:00 -0600 From: Roger He To: , Subject: [PATCH 4/5] drm/ttm: free one in huge pool even shrink request less than one element Date: Wed, 22 Nov 2017 16:06:36 +0800 Message-ID: <1511337997-26698-4-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)(39860400002)(376002)(346002)(2980300002)(428002)(199003)(189002)(36756003)(104016004)(450100002)(5660300001)(316002)(5003940100001)(478600001)(4326008)(110136005)(54906003)(16586007)(72206003)(53416004)(77096006)(8676002)(2950100002)(6666003)(48376002)(189998001)(8936002)(356003)(86362001)(81166006)(81156014)(575784001)(47776003)(53936002)(50986999)(76176999)(2906002)(68736007)(97736004)(305945005)(50466002)(50226002)(106466001)(101416001)(105586002)(14583001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0051; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT045; 1:+muiHsps1jo2O6S5A/CyKnyGvNcEAkBX2tcF8w6Iy8CZk2kJ6cizPtinEM3Gu8cM7pbj+jxHvjToS+PgCoGe+3YuYp1aGR7LUFS09x/MKGK3c/e8cbPBkBW+86DJ/m13 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad9d9702-afb0-4038-42bb-08d5318026a9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BN6PR1201MB0051; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0051; 3:C051im+rw7G6c8gENIAp4pN2w6UdpkFRCvr8lPgafLMgGpS8smNHWf2jMC+EWXHLMrpCjlxJgSjQH16cCIncW2pfXP8rBBKvP2zY+ipPbNhha1ZgP+Do2dYDDN+kYqB/Uo/UbW+0y2C/yPek0ftVaIbk4JsUXiNIqsnGTOf1Lt8RboZmhAc91f22IQQjxszpEHYFQ9bL24WnmIEphenhcHNtOd4UWcMpmOwUqa22oCxqxY5zBrc5OcrsHp4EoiwiPRs714961ykI9pBse62pYSiHh+LV1BiSxcZ7MkUNblJqZIqHp6c0UwBdfjapbR2dWmG0ZKmWB1x4a1O/PpuUZOvngBhy57PeuViLDlZJoh8=; 25:z9WUIo/FbrgUxjX+yGjSpxacLqTUkXuEJc1PcD90cYht5kHqvupumtXz9JX/LxH5yLwhww1ikOn5efYwlsjym+ZixlcxWZHqc9cqBW273OMWEQzyn2l6yDeiRKUQDqTbjkLzIOs0ol91gwXpwn0iG40sZcMfQEEp+9+DpKmrfMPgu3B4pCkPNIpO4KJJWutWcsGZPBTxJton0HojEsEU0GEh5jga/m5qfZ4dKl7IW64eOjzJHZzknQ0VxS+AesmyvOnHi5VywfIDlYVuJb2iEYs28PKkkxz8JcF00+I7N3Ayb7o7+A7cEVvYAlDF6GEBl/x4iTkpNKw7FdfJqIbakA== X-MS-TrafficTypeDiagnostic: BN6PR1201MB0051: X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0051; 31:rXznosJU8c5z1hurZyte7k9MhGkoJdWQEjuq3+4QlcmEJu5m3tKTUvIWfiyLohiO81iYt9LOzhZWDmfUt1gz34nx2copmDQ4qTlNpX4YpVRFOVbS5hum6MbW0k5oPVRWr1084SjBZF1CJZGYpyAWK9YPFLJ3mBlTK+55R0BKiNKXaGtZFk3T3IYtw83t4v7dxo3yygj1OvvkWJQRKNJqlepLDoK8NqLNwotju01bTwI=; 20:B6VmZZIbG+1WYxaH/N9eqhuX2DXr2B4fg2OZYwxjzY5hyABV4waVkZv+oin8mhuK1B8HShfehjk6mGRTP5Q8UcBco2X3l7BeEx0OWgEVF44D/OQzNVl1HAM4KvpppvP9fiVhtgkts2oLeHxmpnjCgEleTFjx1AqfyDV6m6JldlaAIHu4V0F4I81mUwdeArIXIXrlRU7lU4NqV/0CEkh9lC55Ob83zDDlv24E3T1MrQkZSj0YH2NOBkWOQ0C5iDdsimHUVRtaeaKO7OWF8f2d5dlJgSr/twTw21N8u+4Qj7x97Vwr+C18eoEXHE620ZTRrDADY1J3gespMWpmCrfzDgWROpy7uik6r3Kq5Rw1uq8Kobhzz9pSkn9msyaHPbJxwU116Hhw5jtJNB+gUXn+aMa+Otu03u5O0F1S5nFay9YYtthgHS+E/qoIkGh+ktmu97NpdW0h6FKccrADmKkdgmMBvXbljiZJklZhKQA4cJZkJ9FLo4XSDRRdHTJijpNG 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)(3231022)(10201501046)(100000703101)(100105400095)(3002001)(93006095)(93003095)(6055026)(6041248)(20161123562025)(20161123564025)(20161123558100)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR1201MB0051; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR1201MB0051; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0051; 4:LUv9n6dspn+SBrLqlWYKhwgwgU3OfTCl42m9ykHpk1FNCqPYbmnGcawWslweJVCVb08VIXUSzw196bNTkwjJPNxbkDZXU6DldLttq26XMaZ7dCL5WnATTHZ8/qkBQo5vZV+r094ite4ZUfqRfqCa45d6aNR+fRQPXvjtfz5IFjgQyeKTOF0RTyN6Lu/g2r5eegb+K0WpfbnHVvwO78VsUEI405Et6oVwByQycWfpzTk3heEXxT14MceW6tEQ5yvLoMhBEPelHg2sHkF/iQjuyKrzJcgwF90OU5Y3/FF0zlW0l2zA21mRz4TownEmMJEU X-Forefront-PRVS: 0499DAF22A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR1201MB0051; 23:k7NXSBmltjy73+X42GOXYEbSbjqSiKXDsgG3LJD?= =?us-ascii?Q?hSzhxPlpeIjSls3C7ONk0vKF3ZFtZlhEgj4l7CWaBGO5KbRo+q4dImxYbXWJ?= =?us-ascii?Q?jbLeE6TvQi0H6xqp1iDvySptOr7B+QnOh7eq1WxsHttKyshNODB65Lug4/mU?= =?us-ascii?Q?z5j3cjn8fafmfngIENjqU/et0YdxvSVc7puBlxwMP9Y8imJPdNL43w0QFsrK?= =?us-ascii?Q?eBBmgDfVxK/KhNXT3NUHavxMSGreY25IN/ueSmUaOZWRlfv7ne3/gMisJtiW?= =?us-ascii?Q?XFbK8QA5xD/bSjqBn+VDQn4Xtfz+YPKmIl0RrXQNDdmUTRWYHIG8TQJ/swGx?= =?us-ascii?Q?1gl3Kfk7ycrViDxySeweH52QOJQADIRvb0xo2OfbrCwLBXd4OHzPK83xXtWd?= =?us-ascii?Q?1YohoRy2GcHJSJFChiGZG6vUmAAJcS/d6EyS/4AsneIMu90UCTziSFkkVD6y?= =?us-ascii?Q?iJxfMR9v2sOkzO88/W/BkPe5+L07wW5+qfR1FmBJFEDbhRXe9aobnBypfPYn?= =?us-ascii?Q?DfJbNHVntKRXKW9PaWIrllEWefG8uaAzaylHTfCn4j2HuSLIxdle/hWZfz5o?= =?us-ascii?Q?pK50D6q8j1DA469/pEi9MF2HaZedz36cmbs1Qorxk4Q0CkJEmgVdHfKHhFwZ?= =?us-ascii?Q?zSY6fS6ZzcLYvdBYnxOnbCEMl3Js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o8aeS8T1OTL2BoORMAMHJ5GzUfdVZjiG+NBQsKjcpx1OpwMZWHkzCOFUXCRvuSUAqYoUWTVlARvb5g4rKTRg=; 24:Mia1eKx8MkIwxhzdc2FLBPA3iSqN29Dkr1f5loiaF4Q8IVmH1+tN/eihBpNYtL9kEdX/0DfI9IkuZ7fa60PoMSjNWkwsk4g8Cy8rObeV8gE=; 7:paiCGU8NacU8HN8Xt+DMuiC5p/b+gBn1Jz38eCuCflRz3uE12CU1p1a7MzC+M/N8IJkU26Ygsk/+Mb+bdNrxoR9UOYJ3fh1FVC8Zbajzc8le3f1E5ZuYNXYeEbiTDioK8ncEkKQIpdgQk1h5Odob0BHtTAyh6z1Y3Ou+9hln6b6hwW5D5G+n5rBLUEMw4bXkCRq8J9zj2SsKtiCeaKhLvO+HAC1FLJfb0BClAwq1PZNSSrVhQvCo5/As5hEiwbC8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0051; 20:IaZR3HGXGAFZ0JhlYA9EUPaGkJzqcSEo0gKPBHSgiaIGDD/ZDHxlpNNZSGiud7zz52HQWyujXiIjbe4kT6+G0W9bSE6G96c+VnLBOfaVYhTQuYx5YvRYIIDC3KFvI5II98ri3uupH9jJ0g0dfAGIIfNHtcH2JMmtie8i+7o7CFSGiX6VwlKzavD1bfn1baZuYPvv5+mT5XJqsPaXHJSb8sAXIq1cLRGiNqdxj08IVVZ3nh6t+xo71ytZZBsAdhl3 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2017 08:08:01.5745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad9d9702-afb0-4038-42bb-08d5318026a9 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: BN6PR1201MB0051 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: Id8bd4d1ecff9f3ab14355e2dbd1c59b9fe824e01 Signed-off-by: Roger He --- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index 343db0b..82d40c6 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -444,11 +444,13 @@ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) pool = &_manager->pools[(i + pool_offset)%NUM_POOLS]; /* OK to use static buffer since global mutex is held. */ nr_free_pool = (nr_free >> pool->order); - if (nr_free_pool == 0) - continue; + if (!nr_free_pool && pool->order) + nr_free_pool = 1; shrink_pages = ttm_page_pool_free(pool, nr_free_pool, true); freed += ((nr_free_pool - shrink_pages) << pool->order); + if (freed >= sc->nr_to_scan) + break; } mutex_unlock(&lock); return freed;