Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4247199imm; Fri, 18 May 2018 01:44:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrsxUgMdGFb0YWpeE2OloCqSbQoo6PBXEL/MC/5WnASUQexJTqS6Ry6SNiCCYiXiZyfBvne X-Received: by 2002:a17:902:ea:: with SMTP id a97-v6mr8417532pla.28.1526633071863; Fri, 18 May 2018 01:44:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526633071; cv=none; d=google.com; s=arc-20160816; b=n9EykGDKUcrHmfHzCo29mmqPEv2vPuuKmuU4vg+002XNOAxiPYotYS3+xONGyjm0ei I6uM002b4vfBK9/hdFStnAI1FQWa5vCWwOMlCciLMRv8Me3A23aphGPUGv7fFLl+ychb TduMLtbpkYR4T6K2qX88JZLuOYMU+2XQwNvhkLktnNss7qhcL7XzPJCvEPZodtmhS6St 3zTleL7CbCObbI4mkG6jSMhlz2vj6jD5fDvhI/HVQALFcgRL8nuS7i+Xm1/w8+nuXRri YxLTU8RxK68daezWWewQg5UjJaqmcPOH/dPQUCySSfrrGTRBER3RoeBiCJusaX1eH1VE jAHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject :dkim-signature:arc-authentication-results; bh=6Lv+JfRhmpiB11xmNRi/HUFuAWVUELXj+iX52Hpqp+Q=; b=bOr/vqww3Dq3NEewlSZizfSYPZQB81lx/VTx7xyFccs/qiS4SKIzSnkG9WywCwMNDb 1lJ+jj45rFeo2s9H6RJf6OtNzBhpTwBhihVQJy+mMojzwV0kA07DdK0KxgXr5evKcKPn JqPuQcOrTT26DdQQRmaOi2ATc3antsa2mirGVY1rHEF0W4HKd0rasiuV7jYGfluLt7fH fuPSIbTWukByhxPN9OO5jkQQzY5Pp0Z5VtzYX1n0dfTL+Qt3tHNS3LlnUnBkH2WxnYBx wCLBiXiSOj08jRmtrxXZKS35e6JxpjRSZjRbG7Gok1A3IzP04+ykhf3fXHveG0nY2+HI G36A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=AI5oKwOA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w19-v6si6695178plp.538.2018.05.18.01.44.17; Fri, 18 May 2018 01:44:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=AI5oKwOA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753591AbeERInB (ORCPT + 99 others); Fri, 18 May 2018 04:43:01 -0400 Received: from mail-ve1eur01on0135.outbound.protection.outlook.com ([104.47.1.135]:3712 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752473AbeERImx (ORCPT ); Fri, 18 May 2018 04:42:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6Lv+JfRhmpiB11xmNRi/HUFuAWVUELXj+iX52Hpqp+Q=; b=AI5oKwOAA/6ALi5i36NWrbU80xfQkX0KQs5UbpJd8POClj+Osmw+OA7fjxU5Um7M0O6em0jFd6kY1jBif6rWP2v45K3txC7qpgIvjCLxVpGhixzPTD9c5zuIPhKadvGVFqa5Vcx1DgmsnkQAMmBXriaxssUJKFnFOkaUEl7a/Rg= Received: from localhost.localdomain (195.214.232.6) by HE1PR0801MB1339.eurprd08.prod.outlook.com (2603:10a6:3:3a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Fri, 18 May 2018 08:42:49 +0000 Subject: [PATCH v6 06/17] mm: Refactoring in workingset_init() From: Kirill Tkhai To: akpm@linux-foundation.org, vdavydov.dev@gmail.com, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, ktkhai@virtuozzo.com, tglx@linutronix.de, pombredanne@nexb.com, stummala@codeaurora.org, gregkh@linuxfoundation.org, sfr@canb.auug.org.au, guro@fb.com, mka@chromium.org, penguin-kernel@I-love.SAKURA.ne.jp, chris@chris-wilson.co.uk, longman@redhat.com, minchan@kernel.org, ying.huang@intel.com, mgorman@techsingularity.net, jbacik@fb.com, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org, lirongqing@baidu.com, aryabinin@virtuozzo.com Date: Fri, 18 May 2018 11:42:47 +0300 Message-ID: <152663296742.5308.2135909277633884465.stgit@localhost.localdomain> In-Reply-To: <152663268383.5308.8660992135988724014.stgit@localhost.localdomain> References: <152663268383.5308.8660992135988724014.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR05CA0239.eurprd05.prod.outlook.com (2603:10a6:3:fb::15) To HE1PR0801MB1339.eurprd08.prod.outlook.com (2603:10a6:3:3a::7) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:HE1PR0801MB1339; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1339;3:I71gx8C0SUyS8xnCBBh49Aoku+Aql+/GDPNWBjN6L82A4M1yeI9ImmYWm0P8+pEQvaOpSNie0b2NeQWUxHJE8+QjTs4fmMxDV+WChvRbcWbXKsvl+dGV4/BJ38FsnAYmwm3vWHzbYj6hYRwurdFCAbQZ4eiccbFOFxp7rf0XrJB5YG6H2ysIKmw0OtZ+J+PzzSI62okCCGySXvs880Yo4Np0dqmAzm90M3ipPO2SBZRn7c+GS5wppQMBylLwLlDh;25:YMD46cV+N3vJph8spnzogxAqF5NVb/lIzxAayhm6ynhNv2OZN9esDMOn9NbasfgnMQcbJDz0n7GCRCfKAxbwkR2r8e5AWDz3IyZJnNPa6ylxfvMmL5ugxyNHCov0AnwhbkE7Lrr0vyKMzNwCDNP7uyH4Q05VuBR9dzbwj3zCDL/sCxh6mDwRR7CtVjDWUR8rmm6fNZv2Nl38u69udEGaCwK/L8kmoh/rfWlzOdDnItwQ1Ivu70GaAu/Ao/5qx6LKuQmyISzkRI92DtuzbG6F1wgAW1+5SmHj+FTTIoLotx6OLcbW2jfNgCw9UzOds41jk9QJARMZGG5N6HWOV7PohA==;31:ecgsmX/J5HziBJ8rPxqeRxLCBal4gSqoKnQsHYbMmkqbNB0FFe3xAsLA5G8Inq84XD9N/3xjITGc4k5Fwkznn6jrOtqKyK9LxN7By+gpD9MGy3nP5xlPQJGjFJ9pIWAf6rysZ7CHSBk+JNxB8WndyEFdcROgkhQG4BIuyBheXllhLqNaGhzo9OHRXeGqp4cTJnlixb/io5sjsUtStoKFxaWI7zi0NU5qegnr9RZsmYM= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1339: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1339;20:YiL4cve9Fbqlc4oD3MhGzwq81f/4WVtPdh53PQGzKpvXF4WNS4Surn24s9cqTKaL+FecGU2tubM9Y6+8/kUO7I+Ll967pHsNcRnu4i1MVOZPZAG3qtOLxwB/DfJruRWX8e6nondPSri+xr98vI9YmnkNnW7nhFI/lLV0AXsvioc2x/DEqJ9JNzDMjGtxfppZmpVXHYJuECleMz+E5Sgyt5x7ndcF7VddlC/TOofGz7gPoOwkFYR9rKMcAugO+QDBo3GvFooPjG0Em84iYDXA5MfuecI7ew40ykd3iLLGtbZe/xYIfXLd/kZ5DDvHiEVX9WCsaeDL7UnCi6yj0Hgn6Fq9Phz7iKUBvmV7qxs0Z05h7CkwmgiZVpZPQjojIYcQyFy+K8yY+XjmS1mpDbnTrJIikuUjrtn/4i17A4ndFWeYqBFkRRNZaEehoc+QPsEKvIev8V3hbQuiZbkT2gFQKWvtX08IHHPXhCJwtA9FydVCqSDHjO98BV3jeMzALcSF;4:N6obrZQ3ANi9JxtvSxUw/YcAA09NNqMFqMXx3us8kJqBu9v47u+HRa3/jLwu1G02t88TlvSUXMx/TYLiKa+LrtbfpcWsQSvB0tUb+PgB30Lbjz13IyxDVTWfWrWtoOh77PcDgI2mbJEy0CHfH4Kwh68ulIg5P3DMgPWhfoCuxBuWe+TaVmmSbpU+5u+ZzpBgjcIqJMNu97M42T7kbcu3n2JjEADd6TkjOmAQI13hwDnfeYrJxPbLTa4N+rGZInav1QKVRovY8nWB+MnBKcvJag== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);SRVR:HE1PR0801MB1339;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1339; X-Forefront-PRVS: 0676F530A9 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(366004)(346002)(376002)(39850400004)(396003)(39380400002)(189003)(199004)(230700001)(97736004)(386003)(6636002)(6506007)(316002)(58126008)(16526019)(103116003)(7416002)(5660300001)(186003)(105586002)(106356001)(52116002)(7696005)(2906002)(55236004)(8676002)(81166006)(81156014)(68736007)(47776003)(53936002)(8936002)(86362001)(76176011)(59450400001)(39060400002)(25786009)(23676004)(33896004)(7736002)(26005)(478600001)(66066001)(2486003)(956004)(446003)(476003)(50466002)(486006)(55016002)(305945005)(61506002)(3846002)(6116002)(9686003)(11346002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1339;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA4MDFNQjEzMzk7MjM6R1E1bnZCSUpkcmNHNElzV1cxQWR1Uy9H?= =?utf-8?B?SVFJMXRUdm10ZytzOG1FSDd1Nkc1eGplWDJFWlgwSWxYKy85ZjYxbkp4SEor?= =?utf-8?B?SjMrWnhpRnFrWXNHM0tndGc3S240L2VLZVRqOU9Ua0dtMms4am1zRmVHdy9O?= =?utf-8?B?c1hJTEM0eS83Q1FYMTlWaVpQcGwzS1NzL2dORGhTbFM2dkgwbG5nUEFZY1cv?= =?utf-8?B?RTZxeG9ZUHUvTzlCdEV6SGdIRE1tZDdvL25RVUZyeWozTWtCZ3B2bzlmZ0Vi?= =?utf-8?B?UVNSTHE3dzQ1RmtuOUFEOTZhMTFnbnhSSHp2bzlmYXg0Si9iOFpndTZBSXBV?= =?utf-8?B?Rld1L1BPTEhucGlYWVBKdy9nVUxWem9SRHprTkx2K2dnMH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MJXrhvefYol5HnJvNM= X-MS-Office365-Filtering-Correlation-Id: 17afc771-eaa4-42d7-eb06-08d5bc9b56cc X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2018 08:42:49.6578 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17afc771-eaa4-42d7-eb06-08d5bc9b56cc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1339 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use prealloc_shrinker()/register_shrinker_prepared() instead of register_shrinker(). This will be used in next patch. Signed-off-by: Kirill Tkhai --- mm/workingset.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/workingset.c b/mm/workingset.c index 40ee02c83978..c3a4fe145bb7 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -528,15 +528,16 @@ static int __init workingset_init(void) pr_info("workingset: timestamp_bits=%d max_order=%d bucket_order=%u\n", timestamp_bits, max_order, bucket_order); - ret = __list_lru_init(&shadow_nodes, true, &shadow_nodes_key); + ret = prealloc_shrinker(&workingset_shadow_shrinker); if (ret) goto err; - ret = register_shrinker(&workingset_shadow_shrinker); + ret = __list_lru_init(&shadow_nodes, true, &shadow_nodes_key); if (ret) goto err_list_lru; + register_shrinker_prepared(&workingset_shadow_shrinker); return 0; err_list_lru: - list_lru_destroy(&shadow_nodes); + free_prealloced_shrinker(&workingset_shadow_shrinker); err: return ret; }