Received: by 10.192.165.148 with SMTP id m20csp925458imm; Thu, 10 May 2018 02:56:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZquK+tTitHaZku4s4oG1mf7RE6Sw1ctv/wWXT4kjiF0lVJzfRUV0ofB5zV4FKpf1mPry0mb X-Received: by 2002:a17:902:f83:: with SMTP id 3-v6mr732566plz.336.1525946210491; Thu, 10 May 2018 02:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525946210; cv=none; d=google.com; s=arc-20160816; b=mnJ9xzRs341u1P4wxCDlBwgVAKKAxbQ3GqUryPa+quIziV4L6oclUr86rJcPM2bH+B WFsLy6ouPuBUU4xOPSE/8mfdUlB3xFz33WDuclVCbXq3xmQD7BRFxA04Uv6uDM5R3sRJ 9WbSCPZpT0ShRq3AzEHhQhEqahqRxut7h1sa/ZESDEI6UzRQmvI2OzkX/cS9HG/8fYUG lCZvyPPkgX7LVYIgL2Az/ZJZF7xk2KR5b77IwWuSoZJ3auRyiGN3NLhiK5yB4oEjOvfv BY1cOHo4CY0S13kc8n1sg7++/tGyUSMLsyuUJHuIqyDOkAfW6lENCQWXvONNGLKGrskM ZH/Q== 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=QtMDdqmNqbLAyYksw3Fb8rxQ2nfIy+8CcEWjF8XJpZrkpi6+0w0IZFAXGRz/Jvbim8 IsonqiWQIgWDms4aBbgtAZUARt3iH1sCJgXVphKiSe8HHNex+ett4mJc4Fx4SHwTAV2I uv1hL4/SysAX5dF+e6YBJ6WMxZI94rmPRjMG+LoTX6fWi5vkYcBNR72g5n6pDF6Bgk0Y knC8oa6zivc3PdVZbOsPGJGsDWSaTYWctBcuhNsPURx2n3C/+mro6kfbcSaREADHrvbM ZCkf1qzZ5v6WylxnG85xrRKM/enMk0QaxStQtEEM+OUzYi6PcUDY9qrbRnMmYuoBTPLB 4M3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=GjgsvHd4; 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 m32-v6si439536pld.438.2018.05.10.02.56.36; Thu, 10 May 2018 02:56:50 -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=GjgsvHd4; 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 S935122AbeEJJzm (ORCPT + 99 others); Thu, 10 May 2018 05:55:42 -0400 Received: from mail-db5eur01on0121.outbound.protection.outlook.com ([104.47.2.121]:7494 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934869AbeEJJw5 (ORCPT ); Thu, 10 May 2018 05:52:57 -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; bh=6Lv+JfRhmpiB11xmNRi/HUFuAWVUELXj+iX52Hpqp+Q=; b=GjgsvHd4NVziPtBenvUOQGL/rk8bjl31/KrlxclWMZ1FpUhujAuTAzrVhMXVlFXwBGLo456kSKVwbWm/CnDNjKum0A1qANMYD/at5zL1VeFDw5aLlLklcQuh8UAs/nHv1YejJ8ubn2INhxN2Jbi7TITzy63QmRoNovxzmtUBUo0= 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.735.18; Thu, 10 May 2018 09:52:50 +0000 Subject: [PATCH v5 04/13] 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: Thu, 10 May 2018 12:52:46 +0300 Message-ID: <152594596685.22949.8660258274427608623.stgit@localhost.localdomain> In-Reply-To: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> References: <152594582808.22949.8353313986092337675.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: AM5P194CA0023.EURP194.PROD.OUTLOOK.COM (2603:10a6:203:8f::33) 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:K5lK3+uQ+y6CF0d9xdlXXQejXW2tv/HCwokS37UpWmFyc4xQcaoEuy4vpQk8XzSMTBeR7koeT2KpD9WgdeyMQV+HRy0Wu7+D6QyzIvD6+7DIsiFZOheEHa1K2JPIBm/q35A0ChsvByr+CZg6B3JWSBGkKvotymxmlHWEMC3sHamKSYfwjKQGKi9Lc3/K3RZ4eDk40ucnJrCvxFH/vls9zUhBOy4QQVJHWcgC4fpf8u2K1Gft8DxQG3MOIPcMHevT;25:8qNRAfd6JjiAznSW1ujRnd2Vt1n81o1obt+0NlNyef+1Q8YB6nagAqVnXQYyRadtdIfwDY8WYP+2z8V+6AEmXanNbOwTBVYCmMgAte0dx8cMlbJ/fa/WY6fuwvEbhXq/WMEURUjNpiq+jv482EDGDH+cMA0Aa/J8geiCxA7XNJ43s6O6JJNPBr33fEUOAwQdOZJpByUEwf/OSEwTMmF7wMkVghtbJKN8huukKuK5yoQjgkwqxqMxyvqm+ndh4oTQognDa8tBKl/xVGvshwN5yJmX/Tvvb1v5oqgIMBxMmcKlXbTlH8JwhzkBFECnVqvBUHLIrxmubnpMfDCO1IYpLA==;31:rkQUUZG1pcO6Tm2DD/PK7vkVu2pg2YNFV3KNz44aA7LQcVcaIEAzGOChsCPj8yGpHGxAMM2VYGblWzwj2/NouFngXnoYfynopUDRJrNELGlbfVA3CNkaw6wmZ6mjHn1zlAAqCjuUf6bNzgWsSGsEG8/2gK5gjrq8df16g0o/X9UFNDrbmSgPmkOS95mpuH7eaFhng23/G7Z0HU9kqPSGx92rlfnTmOHfjNEev+GgyH0= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1339: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1339;20:BKVMJ4MrKVL2Uk1sw4Ff2VeudTJSe2xeVJUW21MZARWpTgE5+TQHtc2Awz+mCjMwN9zkXOmCUrN689slYhzXqQ5llqOlh0wLzieasDs5vioJZt0MRSdPa+HgS1MhMJOGoL+QOxPQcV4Pc4/GvNRNqRg8AUUHLP4F5DswTvfXUbauTXIyR1NUmbmupiNKW+wBcUauPNNglivX0UFy63e4n3/U1c349t7bfcDGbyiuLmaRe3NcDhHdBAocOz5XM9odqa+ZjWtdiHMBs/nwX3qlGO6gJGvBKPZPSQIJoPz3sgBVWwjLfM7AK74+GwaLZy5s6C+lhXIynQ3d4Yc2CzFq6PH/HvMua4ZGfPVVMlSC5y7hzm38WrDPnoMUT7f0ZFHbgB/Kfmv59krnJRodDFh1Pv0VEPpyq9lPJPVe5ZxqD3QJ/+pC43NiQ7ZdacX3VN1mOa5IeI6/hO9vZBf4v1iWDOG9BIo8mT/EXMf6qOu9Bi7GIZRHceL2Re8x69hOcZLj;4:2BIfU/QaPL2BdKeqJwMlL19f11EFEuqKR4QRSdqlVgSRIPAITOCJ1guxJ91U6d1q3w+jm30I1d12DvF/xswaPnT5uv6Da9lkA4jr+kTl0NnuUS4i/6KQUMf4g/QYjo7eKpERz8GP2aOAhq4FNMM750OJ86yaE1FEVN9AXG0leiX0CVHywtfvh+nT7yQceGU6RVIUYX3bKnKFqEwQmJSxSiQXHn3RllLmvk0XIR+rKb8OcSOnRWaAIJDI3qc9OfEAkNlF6l/b0Xt7e8ePvMafuQ== 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)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:HE1PR0801MB1339;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1339; X-Forefront-PRVS: 066898046A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(346002)(366004)(39380400002)(376002)(396003)(39850400004)(199004)(189003)(316002)(5660300001)(58126008)(52116002)(7696005)(7416002)(25786009)(7736002)(2486003)(478600001)(186003)(26005)(8936002)(106356001)(305945005)(81166006)(105586002)(76176011)(97736004)(103116003)(23676004)(16526019)(8676002)(81156014)(55236004)(3846002)(86362001)(6116002)(446003)(11346002)(486006)(230700001)(66066001)(476003)(6636002)(6666003)(956004)(386003)(53936002)(6506007)(9686003)(50466002)(39060400002)(68736007)(55016002)(33896004)(2906002)(61506002)(47776003)(59450400001)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1339;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjA4MDFNQjEzMzk7MjM6RnR2ajZGY0drNTl2aGRJekRucjljSVhh?= =?utf-8?B?SlV0UFB4Y1RwYmd1MlJKQmR2VnhZZG1tbFZKNDE2eG9VaGxSdlZkcFkxVnpK?= =?utf-8?B?VjhJWnZrd0FhcXBMUit3WC9NV05tNEc0L0VIcDJZeHFKMlFVbGp5bmwrNnkw?= =?utf-8?B?c0VQaVdRQmhlYSsyQTRwZTVUL3NzeFdIaGFQeE4vc3RBSmozMWwweWwwRnJi?= =?utf-8?B?UnZTWS9FMExiZEVvaytDMTBhUFBzQzR0ZmJuVTFDcmtQMUxLUjYvNlk2VXpG?= =?utf-8?B?QmpNRFpGeUJuSjluY3BnSEt0MTNnTzg0UUk4K0ZaUzQ3MnY1V0k0aGdZckg1?= =?utf-8?B?eWR3SDVkZjlMRU9zQ3pQRFc5b0J0c3ZKK2Y0Smoxe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UPollaRapCfL00NY5lBXVkHEIs+/aXVhKeoF88ROZuRc0oCuPdyjFvoWO0pLP2kpDB7NBuXxooDqyA= X-MS-Office365-Filtering-Correlation-Id: d8a5e98f-2bc4-4e7b-ab88-08d5b65bcc53 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 09:52:50.7544 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8a5e98f-2bc4-4e7b-ab88-08d5b65bcc53 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; }