From patchwork Tue Nov 21 09:32:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "He, Hongbo" X-Patchwork-Id: 10067893 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 CE6636022E for ; Tue, 21 Nov 2017 10:06:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C93FE28789 for ; Tue, 21 Nov 2017 10:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDEA928C5E; Tue, 21 Nov 2017 10:06:29 +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 5378628789 for ; Tue, 21 Nov 2017 10:06:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1F216E3AE; Tue, 21 Nov 2017 10:06:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 1932 seconds by postgrey-1.35 at gabe; Tue, 21 Nov 2017 10:06:26 UTC Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0043.outbound.protection.outlook.com [104.47.40.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id E618B6E3AE for ; Tue, 21 Nov 2017 10:06:26 +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=icn7Le0+3YO5AxkIWmGeL5Sf2SO8HPXMgEYWxqvtb0w=; b=teTgGEEewyuRXBcBCwzmnvfmRHS4Z/70crtRwnEmZNsKTPyEAk275MOAgr92JJNoEc0XBnTMuQlBKn8PZ9Diu3lOn4c7f9+0B0T1zA+bpcLB2jPvQCaWG3MWFesnrZ/Sdtb8pe+eBLvZ5QitUUcTynQfWKu2Xdv19LECm2CIs1Y= Received: from DM5PR12CA0061.namprd12.prod.outlook.com (10.175.83.151) by BN6PR1201MB0049.namprd12.prod.outlook.com (10.174.114.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Tue, 21 Nov 2017 09:34:12 +0000 Received: from CO1NAM03FT007.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by DM5PR12CA0061.outlook.office365.com (2603:10b6:3:103::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Tue, 21 Nov 2017 09:34:11 +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 CO1NAM03FT007.mail.protection.outlook.com (10.152.80.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.178.5 via Frontend Transport; Tue, 21 Nov 2017 09:34:11 +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; Tue, 21 Nov 2017 03:34:10 -0600 From: Roger He To: , Subject: [PATCH 4/4] drm/ttm: free one in huge pool even shrink request less than one element Date: Tue, 21 Nov 2017 17:32:22 +0800 Message-ID: <1511256742-5601-5-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511256742-5601-1-git-send-email-Hongbo.He@amd.com> References: <1511256742-5601-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)(199003)(189002)(305945005)(5660300001)(104016004)(86362001)(53936002)(76176999)(50986999)(2906002)(101416001)(16586007)(8936002)(110136005)(356003)(50226002)(2950100002)(6666003)(316002)(5003940100001)(189998001)(48376002)(77096006)(81156014)(81166006)(68736007)(8676002)(47776003)(478600001)(72206003)(50466002)(97736004)(450100002)(4326008)(53416004)(36756003)(106466001)(105586002)(14583001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR1201MB0049; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT007; 1:DYT1RjJyhC5QAlOfuD5akhJbAivBPHaIHpX7I+3F3u3TGzIZ11jEA7FujkcFGWhvRkkaYvDhvH6m9I7mI5hI+B3daPae+zNIvjeEsIYTh0v1pT9h087qMp938SN1RX2G X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57a924ee-0dac-4352-a890-08d530c305ed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258); SRVR:BN6PR1201MB0049; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0049; 3:0h8kEZprUlVVSXlunPG6rCSkxy0iJHFPulCZqNy04kNMjWXentoFLMxB7tOZ2lQcKjLJcXDoKd9BdB1wq71f7hOWin1YYQOQob3oc3L06qkRu+1vR/vFxPmgG+G3gt6CSD2zpfrizl7djqQl++C2/bV1U3xdktbE0AMcW5MmG+GaoqCaweOZP2zpp8I0LFqP4gLJ2r/UrV5BIa70Jren7ywLlz9T5suHk/WguJPpuqYWmhYMyG9XzOf2JSbZOREg8cuQ+fx48vUg0kXFaDijGeXiZ2TfB7O6z8saI0G3lkEbNDJ5A1sj+W2BMDxVbJ7dfqy63JVOihhiuo8BpT2ImeNRpYW25f24z3JRei/qixE=; 25:G9P1aRNIoAjbkAsS7hN1UmOkF9ftSFx95KDph50+8xySHzGbvKM1vEevajbOjZE30+nFdb6X5wxxVQEH6UF6TH6rb0LRyn1LYs9GzJ/58RRvSaZBzenXBnNrsgtWHjGr3NlVwfF64VflU4i41gVR+3omKzN1WYN3TCrtoYsgg85lJ2hgJsIkkb+rfLTLI3faw8SF5aOUuqt8Lh9jHxgOjDaLJ/VVuzarEoDezT37ibtc8bItWcQSzEr3tSVg/F0GsR0V3oWqpREa/LcSlg4BwPslaWpH+4GPMGOLkNWHqFKXs4aye43P2gp9nk31AALXC3a1/ne32Ytegrf88Tq+lg== X-MS-TrafficTypeDiagnostic: BN6PR1201MB0049: X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0049; 31:izgGxd32jANc/X2HOZdbYbIdL8CSXJAL1zScaGYYCrFjD8jjl+rfRsR3Fr2DjKNhWEjlL5cJN1vmQQ4yvCt+kdQmabWWGRdvwGD/9iM98xYVEpjUOL5NBNufKeuc9fRivlQCjWXFtEn+6I/sqtukSCDqk4xXzPRzeoLs6kNsW7fqq0mnMCJR7Y1+MlFuVtyzAjz3kvCRhc8C9JAp7GTltHXE1PbQnkWJs75MeIJUdlU=; 20:BSyNC6FdORlg3RJfzQoutTtaZYOHHzQjInMxoyoXlRuahqyFMPkTOz6dpmQ0TKs2ai6BXU6aeyL3McSP1YdjtmZ+RZtU1H5IvVZyrpEaeWmRYREuUiV/uHeFFuv8sxkjqAVFHr6N13Ph2Q1eBgUYwyVOx2UmxZfNHqw0hAX95UzsmA6NkYUQTTl6AapDo8LTOpfQKz0DUl1I7VdckJc2SYbvOxAGTZTqzBc9ms45pcpjE/tOIjnwX1L0eWiJzCKTocl84k62W0NmMTbcdgCfd5K+2p2VplhD2umqUPdt14QqhY7dgKPrNdMCha+rPsQQfeeGivoQwqvcmLApI08D2SQuzkaiUf0asES/ufZTksfzJl35PL2xyWtauR61OQMAfd1Nrtc98TUGEFlNNcQulTx1bYZbVuiHk7oNZsJOmaIiqIxBTtamoHDSV+lmu08xqk7UBd06lNH0B3QZ9rLvWSBA90DjXEb6bbLY71pBiJQigl0D2oNNtmMFYuhjaHNe 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)(3231022)(93006095)(93003095)(10201501046)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123560025)(20161123558100)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR1201MB0049; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR1201MB0049; X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0049; 4:Cnh46LW4MgGRY+c002eiDvwatyIRnN3wEexy6iQH9k4Z15Y2GnRIc33G4PhtHUdh0fSbG3IBVw8HBIFWmSJ/sV8z9fNKgFY9bCSim2JjcyYjBlGEQwaywB68f2PHfQijf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6DuYU3zNiDbkYgub1UjiSHnnkdWFj0qElBS9lE=; 24:2KVJ3dcLxY3p7oIo0ZA5uNwECjvbERVf5+qmJHnliOzykeSIxy1USl2xu2Urq4/fF4NmjnvpDZr/ppeehu2F9PYHV7fzg1+2qVIESNLFPAI=; 7:goPRK4BrfXLWDel77HyOFroKpBTdGRg/6+HaWDLHSn3g8FZIFdn5ZBu++OXKd9inaiCYXxnayRsjGalHixuP6uvJHTE8uYBA0MCtawfLY4zd6W3gVY4F6NNP0OVQxG8GINxOD2+TYn3GVgq16Bb4VHrUGC1/giT+DOysDBEBMni85FDzhZ6kGzMa4zOHtsQQQbZWff1ZX4z+mc8eey1BqEL0aWKlVyrjjFjPMGbNIbwYe03D6PdL0ObF3YMJka8D SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR1201MB0049; 20:q5E5C0Oq3eTCA9vG9rj/HIPRSeJ10TmQLE/Ru88A235iYTh0z3ebvCbDBmozqK4L/EWFrCpkQ3xgI2e5MwPfzAruAT6+b5Iw6fi3TsDDQzNVW9RqUgr1ueSuQYUhPWOFJIJcmQU4FvXyJREHskC1q61lLjX18G9ElSvrZ1s8g/qnNwXTGWztLutjGEWTRg7snsTs5WUQe9Abth6Ipy+PDoqgk/k6Ma8ofg1+YPLrMZuZ3AW2X6PqzKDmb0UCr6NA X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2017 09:34:11.7135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57a924ee-0dac-4352-a890-08d530c305ed 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: BN6PR1201MB0049 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: 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 90546fd..c194a51 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c @@ -453,11 +453,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;