Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5037100imm; Tue, 7 Aug 2018 11:29:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpezh/d+pf84o3KeR+Fx8oMAdQh0mBqKTzsT48kbuDdfJROkeYgicYdE3JITp7nFiiTNcPSb X-Received: by 2002:a62:b29c:: with SMTP id z28-v6mr23214098pfl.8.1533666596093; Tue, 07 Aug 2018 11:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533666596; cv=none; d=google.com; s=arc-20160816; b=e9bm+AywqfECHfSlGhsetKzIimdiKW7/Lfjw4UHpjXzw7rFpXNkv+ZXDuFt4ji0J/U WeMcY1j3UEZhfemJFcAenr4FZQvWQTEjYRx0qN0PJb1oNFG3iBAwDrAfh7P+PXzb0raX EmZMraYzc1wcpDbSiXQnXXOXeH/TBY9voUvGJ5/Db1SvZI1lg0Qf/1tzGmmI/aXLJ5DP vsXV1FFnXfcvgaCm7LeVdeIKybftPV7zMkDMXBJx6B0JDev1xtpqt+JxwRwdyzC3HWEQ Nk/jUsVWgawPga//GOvBvsiAcsG09KsAiASAfOWwOF+T97bTzvsfmz3CmdE9Lv0YQwHm JFqg== 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=KHhaKK0koKcZB5yc5yD4q+dXe27lzN4IMJnbu8sfryo=; b=TYiEasYR+TZR/hDcVjPvRMRh/FJBZrvglm3bN2Lcdx75CezDLwqSruekjpk/MuN6bv lFzD4EuqB/f42GTnRhUE5OXP5UaucrbjsD+3KEN25rk2hQajRi3W6/ssVJw/48VEzWsf r1U/qhD5r5fklZzN/0skug84jL9ghSRXcw1QbJTkTChbSnD6y51avc6SwrOhL5dJbBuz 8NdhQY6H4VEIjQvz0mwEDAsCfJ9A1TXNM5kgauaxOXzYxVm7U7WkKdrmfH5Sb1jp9DxV zrwuNFoUsUjver6paU2ByAUcvk4OXw62nyYnqUdYnr7zkD3GC+FxWiaDOzK89+z8GNiA 8m5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=NvZYqm3R; 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 bd3-v6si1536405plb.155.2018.08.07.11.29.40; Tue, 07 Aug 2018 11:29:56 -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=NvZYqm3R; 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 S2403823AbeHGRxR (ORCPT + 99 others); Tue, 7 Aug 2018 13:53:17 -0400 Received: from mail-eopbgr40116.outbound.protection.outlook.com ([40.107.4.116]:10284 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388677AbeHGRxQ (ORCPT ); Tue, 7 Aug 2018 13:53:16 -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=KHhaKK0koKcZB5yc5yD4q+dXe27lzN4IMJnbu8sfryo=; b=NvZYqm3R5ZRyUy/fhsA7+bAZmeal9lo6kN5g7RnWoNlBNxFSELkWKbUxGb9E4Lh6EhC46j8NQXIclX/wcqC0Ay0SZfSuKmQqLrqCA0dqmsyJ4I49SQO1nFTWei0qzEtVafHLC3B7TtbijUhId8PYessrW29JUPOBR6l0QyRxaNM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by DB6PR0801MB2021.eurprd08.prod.outlook.com (2603:10a6:4:76::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.14; Tue, 7 Aug 2018 15:38:15 +0000 Subject: [PATCH RFC 04/10] mm: Split unregister_shrinker() From: Kirill Tkhai To: akpm@linux-foundation.org, gregkh@linuxfoundation.org, rafael@kernel.org, viro@zeniv.linux.org.uk, darrick.wong@oracle.com, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, hughd@google.com, shuah@kernel.org, robh@kernel.org, ulf.hansson@linaro.org, aspriel@gmail.com, vivek.gautam@codeaurora.org, robin.murphy@arm.com, joe@perches.com, heikki.krogerus@linux.intel.com, ktkhai@virtuozzo.com, sfr@canb.auug.org.au, vdavydov.dev@gmail.com, mhocko@suse.com, chris@chris-wilson.co.uk, penguin-kernel@I-love.SAKURA.ne.jp, aryabinin@virtuozzo.com, willy@infradead.org, ying.huang@intel.com, shakeelb@google.com, jbacik@fb.com, mingo@kernel.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Date: Tue, 07 Aug 2018 18:38:12 +0300 Message-ID: <153365629257.19074.5257843346605031007.stgit@localhost.localdomain> In-Reply-To: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain> References: <153365347929.19074.12509495712735843805.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: [185.231.240.5] X-ClientProxiedBy: AM4PR07CA0006.eurprd07.prod.outlook.com (2603:10a6:205:1::19) To DB6PR0801MB2021.eurprd08.prod.outlook.com (2603:10a6:4:76::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf64a4f9-e62d-4738-0b7a-08d5fc7bcc24 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:DB6PR0801MB2021; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;3:Jjhg9hl0PGi28VW6MlST5xLkv/Ty7ADCqvbMngxBQu84Vwzr5Zaera4aOmMK8iAJJ29Sk7G8HXByex7QxY8L7BhwxZcF0IRm1iaYMEtfrwaqwEN3l6ZuFTrYY5zG4YY5ZJVJynqYXNOcW7hZk4TeaE3q95gGt//1SaCDIE8PHHojQ8TrvXs4cC7wQ9niW+6zRoTKKuxuK4mYC2mo8pNaIbC+fgEMUe8Nlm7ieVWO7fiyGyZVeI0c9cj9qrue3LL+;25:KFMPtMMXE3FX+W0mdlXXrY/w7UqtEt9D86fJsKvfYGbUP0S/nzJQ1qDuuSdqAmKojfuVBe29d9zFuWCDQabz32/97+WwyN2n299boCE+KuI6InZ6avMpm/+Dpo2ReeBW24SHv2U5iO58RVoPWOSpOinvEuMjzHc40y58127oMjDbmJNMQzaj73A+hBLI7o+ZmHekMUej5eXAqHYiQcwMk15yQSV54rPGWu0VAKO4uaQiQ+qEG+OhKzz0UWk0NXaDAvJ5p/uiYDNzo1hSPvXEeh0tG+T4K1ORbKMhjrB70BXVF54OHzR8AY787g0ZJEBVZ1TiuyUQX8sngpvGjiH8pQ==;31:SudW5iZls7TBUlcnMc+NFnHwZwAtVxvtq+Pz8g1MYV4Wu9/wNIQZYXphpb+Ko43gbAi6q8e0Os11MHV0QesWBlclYYtmJ44/oqd/M6DvRmFTRRsLsZFVzMaHVo5HH1vmoH5QvZCF1JfG/Mb0yObU5tmfW7Qk3yIfZWLlRoBRgVATjV+s4Zo4XeHUkhnqzJrpqsSpOAGtj95RPS9fDEA6ld6Y02Ew3XQ6i85mv8W8ME0= X-MS-TrafficTypeDiagnostic: DB6PR0801MB2021: X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;20:bixY5YPhwxHC7MZg/YJIqMO5o5QusYhX1IAYqL179vI737N5tLB9+XQtEDEsm3uatwc3gjYrD3sfx90319jcPkdFTDSu9oKQH0hPNZv9OEfbdQnT8OvW3Hv2yfqcNhxiqtbVJVKGNW00cpnEDU7H/unjUW9Ao4hiQ36+kWXrTtZO9rGj9tk2ee0S6WZqNQOnn7Pm1vg/8neD63PygcY50JsHAiuTJb1h6lyQkXdz5coN9DB94nAFvTXzUTBQ6NtiKlSpuIcg36+GidF/007LsaLwmxSDK6JJd6a4qY4/7kkkRPs+2I4cz4NuT/MYB25uiJpizCtJxiu9Cu2XdsVZsQ1xCRsN7WID+mND7VugMyoDcW+OHFOGURk40955fV4qeRFczq4pGEc71yGwiSCnBjgm32J41IUUOViZgKBwOgyKK81T4ixHOS+Nas0r546BBK91/xWPQbri4EWYGNfrbVpjyp1b8lCO47dwvPo04Fzn/yabAyT9gj8vCk3mry4a;4:11X7L1Le/UcOwOI8Tz0ypLJ0f0rc55hjZtcf19Z4ZiestZ/NqTNLLuSnVFARmJLbfkk9//k2fOX+7AVT32w6Hqdov3jt08vt8Mhf8voi4bUvh6GBslXsjzhtH/4KCChgYJFj2EOyntSMIWYwEtp6QlQAxqal9NcMIQzJLYEh7kgPf1rzyut1QIIDJSrjwCvY5X/T4C7WB6is/s5AoOGd9mAgsMlcD48V1awvR6Y+D8JLU6CeW+/eBICugFTF2AuRNJyVNln75jO3Bk6R1xgipA== 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)(93006095)(93001095)(3002001)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:DB6PR0801MB2021;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB2021; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(346002)(376002)(39850400004)(136003)(396003)(366004)(199004)(189003)(230700001)(3846002)(7406005)(47776003)(7736002)(316002)(105586002)(6666003)(58126008)(97736004)(6116002)(7416002)(305945005)(5660300001)(66066001)(86362001)(61506002)(8676002)(50466002)(6506007)(446003)(11346002)(386003)(81166006)(486006)(956004)(2906002)(217873002)(52116002)(25786009)(76176011)(39060400002)(476003)(23676004)(68736007)(103116003)(186003)(55016002)(106356001)(9686003)(7696005)(8936002)(14444005)(16526019)(26005)(53936002)(81156014)(478600001)(2486003)(33896004)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB2021;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?MTtEQjZQUjA4MDFNQjIwMjE7MjM6TVpCYVlObVUwSXU3QVBuT3N4ZUgxelZE?= =?utf-8?B?NGZDeFh2d3FRckxqQ3o0Y1BjWnZGenczeUhnWEcrY09WNWE4WHVXRnd3c3A4?= =?utf-8?B?eFVPOVpRQ3ZFU3ZMdDg5NG9BVWZEdFROSXAwejN1ZG9VYVBiamJFY0VvQUFX?= =?utf-8?B?Sm9xeXc0NjZYOXkvYVFJbUtVTll3aHBMV2xVMUx2V1NXUXJWO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vC+xqx7yEXNZeXte6HnMh4 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;20:QV+9fHQEYBZUWbFr7haq41cnk9W3UpdOzydwRd5ttHkV+1R250GxwQ5r45YFvkaeiuqQKB2TB1SYr3Zf7EeZqQmfQMwWgl9xoBguDv3jhZmFM2DFhoiNBiUGHcEwIwzAoVbv70CaOu5RXisdFRo6DpLDta3ly/jXBloHlv1niEM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:38:15.4293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf64a4f9-e62d-4738-0b7a-08d5fc7bcc24 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2021 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This and the next patches in this series aim to make time effect of synchronize_srcu() invisible for user. The patch splits unregister_shrinker() in two functions: unregister_shrinker_delayed_initiate() unregister_shrinker_delayed_finalize() and shrinker users may make the second of them to be called asynchronous (e.g., from workqueue). Next patches make superblock shrinker to follow this way, so user-visible umount() time won't contain delays from synchronize_srcu(). Signed-off-by: Kirill Tkhai --- include/linux/shrinker.h | 2 ++ mm/vmscan.c | 22 ++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 9443cafd1969..92062d1239c2 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -86,5 +86,7 @@ extern int prealloc_shrinker(struct shrinker *shrinker); extern void register_shrinker_prepared(struct shrinker *shrinker); extern int register_shrinker(struct shrinker *shrinker); extern void unregister_shrinker(struct shrinker *shrinker); +extern void unregister_shrinker_delayed_initiate(struct shrinker *shrinker); +extern void unregister_shrinker_delayed_finalize(struct shrinker *shrinker); extern void free_prealloced_shrinker(struct shrinker *shrinker); #endif diff --git a/mm/vmscan.c b/mm/vmscan.c index 2dc274a385b9..fba4996dfe25 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -422,10 +422,7 @@ int register_shrinker(struct shrinker *shrinker) } EXPORT_SYMBOL(register_shrinker); -/* - * Remove one - */ -void unregister_shrinker(struct shrinker *shrinker) +void unregister_shrinker_delayed_initiate(struct shrinker *shrinker) { if (!shrinker->nr_deferred) return; @@ -434,12 +431,29 @@ void unregister_shrinker(struct shrinker *shrinker) mutex_lock(&shrinker_mutex); list_del_rcu(&shrinker->list); mutex_unlock(&shrinker_mutex); +} +EXPORT_SYMBOL(unregister_shrinker_delayed_initiate); + +void unregister_shrinker_delayed_finalize(struct shrinker *shrinker) +{ + if (!shrinker->nr_deferred) + return; synchronize_srcu(&srcu); kfree(shrinker->nr_deferred); shrinker->nr_deferred = NULL; } +EXPORT_SYMBOL(unregister_shrinker_delayed_finalize); + +/* + * Remove one + */ +void unregister_shrinker(struct shrinker *shrinker) +{ + unregister_shrinker_delayed_initiate(shrinker); + unregister_shrinker_delayed_finalize(shrinker); +} EXPORT_SYMBOL(unregister_shrinker); #define SHRINK_BATCH 128