From patchwork Tue Aug 7 15:37:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7982D157D for ; Tue, 7 Aug 2018 15:37:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52A53285EE for ; Tue, 7 Aug 2018 15:37:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 420A329E90; Tue, 7 Aug 2018 15:37:49 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9903B29E7F for ; Tue, 7 Aug 2018 15:37:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733061AbeHGRwj (ORCPT ); Tue, 7 Aug 2018 13:52:39 -0400 Received: from mail-eopbgr00103.outbound.protection.outlook.com ([40.107.0.103]:23228 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388677AbeHGRwi (ORCPT ); Tue, 7 Aug 2018 13:52:38 -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=HHFDjKdL6Buzx5I7OUG4LnsCYKjp0S409y16pw5PmLQ=; b=VL9qFctIsGB312rFR76hG8lkdfQsaFe30R/A2YNXom+arhp/VfLtioRslmLk6Z6TVmauGxVOjRm95pwkcamPXR/arRraUQYBxYlZjy4Fs7FaZE4jlgo/itf1OBXcAF/2NqBeSIOCN3i5TWM4RedIaaLB//2PQD0VbLvpP44iBnA= Received: from localhost.localdomain (185.231.240.5) by HE1PR0801MB2025.eurprd08.prod.outlook.com (2603:10a6:3:50::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.17; Tue, 7 Aug 2018 15:37:39 +0000 Subject: [PATCH RFC 01/10] rcu: Make CONFIG_SRCU unconditionally enabled 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:37:36 +0300 Message-ID: <153365625652.19074.8434946780002619802.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR0701CA0062.eurprd07.prod.outlook.com (2603:10a6:3:9e::30) To HE1PR0801MB2025.eurprd08.prod.outlook.com (2603:10a6:3:50::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c85a468-862a-4fa9-3baf-08d5fc7bb60d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:HE1PR0801MB2025; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2025;3:N3+QQcOPo3UoJ2bz+ZpDWjELIk8tEgZ//wGaiEaK0sIOTSoP/cXKg6PLfrKux7Yy8lkEXTRhyvNeg+Bv5O8CTS4VSgKk6T+A2JMpuBqejHXV/CCjCZ+CLIfglP6S5W529h82A35BQByMTuXGztB3iPSiZYdybQpJIKwR6UGDcJtCOPejfcG4AkW8fdATXlVOFYhKLbpBEqc0AOffTTFXTE0lyNS99DyLg0DXirp1VszrNKl8JcRUZFmho0omALXC;25:BdPCUy4ijZzlT4gSDP0ICAgh+LdG80zwla2Mr5ENjEBcdH6uBt4bSAJrkREReEbpVTYAN1UmShcgUiUfkUh5IefWZWacuoC2R8ikc6HZXuhW9cZLsN8ilBCQt/O/VqiCFqDigsJy5FMeNRHE0SYjqwFWN0pCPlkaO/TH9LmrM+aESRHwBstpeyee0e64z53dTcK5H1Ha4xRumjLo+FKKSefpitpHZGvT246/5HlVX5F5/McEwJQ0AETn0ctPhyuDq7zEPk9ulYzbVvosgG3rr2PhJfsiPw5G/PDblrwF8gGCiXIKeB/YRyzgt6FLAi1urhB6Kre8HMqzyl689VQtdg==;31:l30VJS8EUu3XdUiLfKgROzNru5i1uVtJiMJB5wIEpu9I9B3R2m+V2uujy5EwcJh4DXkM7D8xhvpo75W26NkWTvs7GQi8uQ0b9XV1PRcm7X9FQMTfs4JenxmKE0zUXcmZfTvYGR77OeaEh5Qff5t1gS9RIpiToGYsDpo2GIgX52FesB8Z4VqSYjHp0RsWIIEjX3ZRgc4/hm0l5TX6ab1B4E9IF6PQBcxsWEYy6JSwNQo= X-MS-TrafficTypeDiagnostic: HE1PR0801MB2025: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2025;20:07Vc/jlEVWSE9q0oY1cqhoMpBZX45iU/BA82Yf43NcDuuN6m9rHGy/AMuMAZLf5W9YnK11J8uAkNp+DfUlvkpYqg1mRGzRlGaKYeouBpG7zNkuzCRgEbR0do2MZrkPn26lN4qfYDHL4dlmJ+hVWRZIFV8PcUUXttOe+rkau8fuJQ8K5TJA+MFK4+RHjwh8FwixO06nscI+5WV2PfzJo7JJseDeZH15p+suTNmLxTnVE0MrDcxYmZble6ydqRSO0JzJalx/41nBPu5ISAabd3QC4mKn102e8+oDrCVXRjZLDONal0kMR9sES0WDI4t23hcoewE/NBFtEKPEM5y28D9u5xhhxpWPfOlCocwRCUSpFuwzAF3wBOr30D5emrXeigbRQMRWKwiVfE0cO+xSZj+PPw9izJvhSbalWIOQE8R/dkx43oTjFiNFtw1HHhKUfoZRdym7PTlsDckyWo9Vk95LldZf15sZ3RYf1JoOl8Gl+u6H/Ac+DANq0oeNGb18CS;4:1g73q+z4zUdX9AH5/BFGuStBpRELK0DhgAoEOuvwUJg3zJLsj+gkwPiknMTFYnziYz42Om09S3cSJ9RVjcvRNSVn3mKZBxE3oO2ojprLgx98JqETOC7nB3nLiFMSWI3LUi1B/0jEIA/I0XMBXKSU0iPqN7IgY+uhzXT4WvPvpMl8PaI7g2QPd05i/Mhhpr6i9w6/3t9O3MdIrF2a2JRpRoWwZfj0U7wYRMY5S+yFDjexxD5+Kv+ZWmjaycAYeSxAZFo3lqpGyp8qXIZ0VK9Zow== 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)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:HE1PR0801MB2025;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB2025; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(136003)(39850400004)(396003)(366004)(346002)(376002)(199004)(189003)(8936002)(305945005)(81166006)(316002)(97736004)(8676002)(81156014)(66066001)(7406005)(7416002)(11346002)(446003)(7736002)(47776003)(61506002)(2906002)(217873002)(14444005)(478600001)(486006)(956004)(476003)(58126008)(6666003)(68736007)(575784001)(50466002)(86362001)(16526019)(7696005)(23676004)(2486003)(106356001)(39060400002)(6116002)(3846002)(76176011)(186003)(26005)(9686003)(103116003)(33896004)(25786009)(386003)(105586002)(52116002)(55016002)(6506007)(53936002)(5660300001)(230700001)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB2025;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?q?1=3BHE1PR0801MB2025=3B23=3AIyiDo?= =?utf-8?q?3lI7DUaydFdn7pnm0MMIbyq17SgnUAyoJp2EW1CG3XG6HsHDNri1PPvtl7yeRA5zD?= =?utf-8?q?QIG5D0F7lngFzHvmItKfe6cXazDnABtriJSyO9se/ils1XT+OQMf2o3LnoX3VOV3E?= =?utf-8?q?9cqYfJR7cp9J6JYNgNPLzhSyU4D2jsBIlZBx1NnxhYf2oBvrqdkm66xJj0FmWVXC+?= =?utf-8?q?E/+qW3BdSVp8ezz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DO8/lCGd1feMhRLdgqAaKNt9XfT7l1b0jzEvTPPJzukU9uteYfRlg70I6iwj8v3nVxblGkJcSvImqXSJ9ea7acaqsNpa4iEHzG1SECGDBS61mdP+STZSw==;5:xJ5U6di23IC9bg+jQyWnjuIXrzu4LsFzcx7Aw9/wOz9kQqhA2ooGgX5AEaBGacB4erODuG8DSUPQL85bj77dX6ggRCQ/WzdmGC06l7KVc88+RKX97dibUKCIMWGNn1Jt4lAy4McbsysY6Pzdwe2uwus/9n2MwF4q3bU86MAPZT4=;7:+oID8+rvhdLp1IaKPKWzPptwKF8mO79GwAE9E1gkZBDZ61ottGm3GiQSsXfnfca/d7eubMHw0IJoPQ4/oI9RXiGR3Aij1tWUec84e+YpYKJ0DldePoEfaKAP3IPwL+xrfxq/30x1HIxTUimNVDot42bn0XSjDrj40ewsQRKn8BRPKLAXFAvoN4o6Bcj0uYQhA0plVdR5y1hKuLx2z1b0epb+6ibjaTmzkcq9MccOOQlDf2FDc6dx+/Pze/Az3TEk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2025;20:hI7OJJ+sqyjQUP2vyRFowQAb3Ku5bPqVOwqRNfEB6VeztthF2XwDBg2hIDQiqvhclKvA0J67wOlphpXILb4mtQyQSMOG2Lx5vrc038amE1YCV/ERAwcYQersNvyNwQ6abkJtqDp2ZzGBcOEg3pVVHlQOljfoHM+EJvwD5obK3vc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:37:39.0065 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c85a468-862a-4fa9-3baf-08d5fc7bb60d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2025 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch kills all CONFIG_SRCU defines and the code under !CONFIG_SRCU. Signed-off-by: Kirill Tkhai --- drivers/base/core.c | 42 -------------------- include/linux/device.h | 2 - include/linux/rcutiny.h | 4 -- include/linux/srcu.h | 5 -- kernel/notifier.c | 3 - kernel/rcu/Kconfig | 12 +----- kernel/rcu/tree.h | 5 -- kernel/rcu/update.c | 4 -- .../selftests/rcutorture/doc/TREE_RCU-kconfig.txt | 5 -- 9 files changed, 3 insertions(+), 79 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 04bbcd779e11..8483da53c88f 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -44,7 +44,6 @@ early_param("sysfs.deprecated", sysfs_deprecated_setup); /* Device links support. */ -#ifdef CONFIG_SRCU static DEFINE_MUTEX(device_links_lock); DEFINE_STATIC_SRCU(device_links_srcu); @@ -67,30 +66,6 @@ void device_links_read_unlock(int idx) { srcu_read_unlock(&device_links_srcu, idx); } -#else /* !CONFIG_SRCU */ -static DECLARE_RWSEM(device_links_lock); - -static inline void device_links_write_lock(void) -{ - down_write(&device_links_lock); -} - -static inline void device_links_write_unlock(void) -{ - up_write(&device_links_lock); -} - -int device_links_read_lock(void) -{ - down_read(&device_links_lock); - return 0; -} - -void device_links_read_unlock(int not_used) -{ - up_read(&device_links_lock); -} -#endif /* !CONFIG_SRCU */ /** * device_is_dependent - Check if one device depends on another one @@ -317,7 +292,6 @@ static void device_link_free(struct device_link *link) kfree(link); } -#ifdef CONFIG_SRCU static void __device_link_free_srcu(struct rcu_head *rhead) { device_link_free(container_of(rhead, struct device_link, rcu_head)); @@ -337,22 +311,6 @@ static void __device_link_del(struct kref *kref) list_del_rcu(&link->c_node); call_srcu(&device_links_srcu, &link->rcu_head, __device_link_free_srcu); } -#else /* !CONFIG_SRCU */ -static void __device_link_del(struct kref *kref) -{ - struct device_link *link = container_of(kref, struct device_link, kref); - - dev_info(link->consumer, "Dropping the link to %s\n", - dev_name(link->supplier)); - - if (link->flags & DL_FLAG_PM_RUNTIME) - pm_runtime_drop_link(link->consumer); - - list_del(&link->s_node); - list_del(&link->c_node); - device_link_free(link); -} -#endif /* !CONFIG_SRCU */ /** * device_link_del - Delete a link between two devices. diff --git a/include/linux/device.h b/include/linux/device.h index 8f882549edee..524dc17d67be 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -827,9 +827,7 @@ struct device_link { u32 flags; bool rpm_active; struct kref kref; -#ifdef CONFIG_SRCU struct rcu_head rcu_head; -#endif }; /** diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index 8d9a0ea8f0b5..63e2b6f2e94a 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h @@ -115,11 +115,7 @@ static inline void rcu_irq_exit_irqson(void) { } static inline void rcu_irq_enter_irqson(void) { } static inline void rcu_irq_exit(void) { } static inline void exit_rcu(void) { } -#ifdef CONFIG_SRCU void rcu_scheduler_starting(void); -#else /* #ifndef CONFIG_SRCU */ -static inline void rcu_scheduler_starting(void) { } -#endif /* #else #ifndef CONFIG_SRCU */ static inline void rcu_end_inkernel_boot(void) { } static inline bool rcu_is_watching(void) { return true; } diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 3e72a291c401..27238223a78e 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -60,11 +60,8 @@ int init_srcu_struct(struct srcu_struct *sp); #include #elif defined(CONFIG_TREE_SRCU) #include -#elif defined(CONFIG_SRCU) -#error "Unknown SRCU implementation specified to kernel configuration" #else -/* Dummy definition for things like notifiers. Actual use gets link error. */ -struct srcu_struct { }; +#error "Unknown SRCU implementation specified to kernel configuration" #endif void call_srcu(struct srcu_struct *sp, struct rcu_head *head, diff --git a/kernel/notifier.c b/kernel/notifier.c index 6196af8a8223..6e4b55e74736 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -402,7 +402,6 @@ int raw_notifier_call_chain(struct raw_notifier_head *nh, } EXPORT_SYMBOL_GPL(raw_notifier_call_chain); -#ifdef CONFIG_SRCU /* * SRCU notifier chain routines. Registration and unregistration * use a mutex, and call_chain is synchronized by SRCU (no locks). @@ -529,8 +528,6 @@ void srcu_init_notifier_head(struct srcu_notifier_head *nh) } EXPORT_SYMBOL_GPL(srcu_init_notifier_head); -#endif /* CONFIG_SRCU */ - static ATOMIC_NOTIFIER_HEAD(die_chain); int notrace notify_die(enum die_val val, const char *str, diff --git a/kernel/rcu/Kconfig b/kernel/rcu/Kconfig index 9210379c0353..f52e55e33f0a 100644 --- a/kernel/rcu/Kconfig +++ b/kernel/rcu/Kconfig @@ -49,28 +49,20 @@ config RCU_EXPERT Say N if you are unsure. -config SRCU - bool - help - This option selects the sleepable version of RCU. This version - permits arbitrary sleeping or blocking within RCU read-side critical - sections. - config TINY_SRCU bool - default y if SRCU && TINY_RCU + default y if TINY_RCU help This option selects the single-CPU non-preemptible version of SRCU. config TREE_SRCU bool - default y if SRCU && !TINY_RCU + default y if !TINY_RCU help This option selects the full-fledged version of SRCU. config TASKS_RCU def_bool PREEMPT - select SRCU help This option enables a task-based RCU implementation that uses only voluntary context switch (not preemption!), idle, and diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h index 4e74df768c57..b7f76400a45e 100644 --- a/kernel/rcu/tree.h +++ b/kernel/rcu/tree.h @@ -489,12 +489,7 @@ static bool rcu_nohz_full_cpu(struct rcu_state *rsp); static void rcu_dynticks_task_enter(void); static void rcu_dynticks_task_exit(void); -#ifdef CONFIG_SRCU void srcu_online_cpu(unsigned int cpu); void srcu_offline_cpu(unsigned int cpu); -#else /* #ifdef CONFIG_SRCU */ -void srcu_online_cpu(unsigned int cpu) { } -void srcu_offline_cpu(unsigned int cpu) { } -#endif /* #else #ifdef CONFIG_SRCU */ #endif /* #ifndef RCU_TREE_NONCORE */ diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c index 39cb23d22109..90de81c98524 100644 --- a/kernel/rcu/update.c +++ b/kernel/rcu/update.c @@ -210,8 +210,6 @@ void rcu_test_sync_prims(void) synchronize_sched_expedited(); } -#if !defined(CONFIG_TINY_RCU) || defined(CONFIG_SRCU) - /* * Switch to run-time mode once RCU has fully initialized. */ @@ -224,8 +222,6 @@ static int __init rcu_set_runtime_mode(void) } core_initcall(rcu_set_runtime_mode); -#endif /* #if !defined(CONFIG_TINY_RCU) || defined(CONFIG_SRCU) */ - #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key rcu_lock_key; struct lockdep_map rcu_lock_map = diff --git a/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt b/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt index af6fca03602f..b4f015c3244a 100644 --- a/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt +++ b/tools/testing/selftests/rcutorture/doc/TREE_RCU-kconfig.txt @@ -73,9 +73,4 @@ CONFIG_TASKS_RCU These are controlled by CONFIG_PREEMPT and/or CONFIG_SMP. -CONFIG_SRCU - - Selected by CONFIG_RCU_TORTURE_TEST, so cannot disable. - - boot parameters ignored: TBD From patchwork Tue Aug 7 15:37:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558801 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A8CD14E5 for ; Tue, 7 Aug 2018 15:38:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08DDA2A425 for ; Tue, 7 Aug 2018 15:38:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE2DB2A464; Tue, 7 Aug 2018 15:38: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70B4F2A425 for ; Tue, 7 Aug 2018 15:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390003AbeHGRww (ORCPT ); Tue, 7 Aug 2018 13:52:52 -0400 Received: from mail-ve1eur01on0103.outbound.protection.outlook.com ([104.47.1.103]:21464 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388677AbeHGRww (ORCPT ); Tue, 7 Aug 2018 13:52:52 -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=IOgHna0IjgNaMkcfTG3lH2LiLelmPRrnFUp70X32rg8=; b=FXqBnciJoI192137vBDlbX128rGMK68+IF9JW+o8GdPomPVZmQiUbXOkEvJAyoJrF2CfUMxrcdGiHA5r0u+R8WCNiOzr8rOwfNwDbjEYbXwa4h0G4HljOIBO5iNdMUzOctjgnGpQj+PedxzeR2xcuPwMb/rvrE+NhEqer9iTAKc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by HE1PR0801MB2026.eurprd08.prod.outlook.com (2603:10a6:3:50::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:37:50 +0000 Subject: [PATCH RFC 02/10] mm: Make shrink_slab() lockless 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:37:46 +0300 Message-ID: <153365626605.19074.16202958374930777592.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: LO2P265CA0164.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::32) To HE1PR0801MB2026.eurprd08.prod.outlook.com (2603:10a6:3:50::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 679832a7-3215-43b5-fe22-08d5fc7bbeaa X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:HE1PR0801MB2026; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2026;3:SGApD3x/zPMVBpLYc2HjeYF1T9qt1J58SZ83TLV2FOa8bED4wE9QuUuwL6ZY3g5b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aupJdAwt2SFYu/I3M0kIVi7nhj2X/00ONZCaxF72xvRFcr1T2w/zaox3wOjuMyOOoVbVLgMkUkucZHCesy2uC6bzCyAksPIZOBqU88OXBN2ni2XcAMaAtz4mos62DxWfU/Tdp85ld88axaj/SCvUnEscc99HT5KjzcXUeOoCH62QQL9nNKqkBJ6/mCpAYp2qOasbOmRI9Ftkp+KKLhF+TdpC1pm2HSKeJ21ogKZ9o1QfEZ/kWPEgw2N/IhlNOzl9SoaoM5JtVZ/NLK5OKipCphc8a/+b9u;4:m8yV8XhbFiyl9ZCqI66IDfQriCkHTYRJjx5roZ6L53Wg/EG3TxnTgZYH5pljYlD+7c6SIRhleBdo6ckMAdJbW8shaKkxMS/wf+i3hvKOIxuGNwsQFD7s7ltK8JbDrzRxsmLDLiIT8v0x6sBf3uzHRTtx+/VyuOFZXo9tBQDJLitSZRpi6BCOlWrmFXhzL4caX0L+xHhsxzIJsMez/A8jAmX2i0FbmVNmfGZnQ3qtOupbGAelAAz3bYRzsDiTNGiefcO7B/wiMZQadEWKuSdaJA== 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)(3002001)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:HE1PR0801MB2026;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB2026; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(396003)(376002)(346002)(366004)(136003)(199004)(189003)(55016002)(105586002)(7696005)(97736004)(3846002)(6116002)(23676004)(2486003)(230700001)(25786009)(106356001)(47776003)(14444005)(66066001)(52116002)(81156014)(9686003)(8936002)(103116003)(8676002)(217873002)(81166006)(76176011)(6666003)(61506002)(316002)(53936002)(305945005)(5660300001)(68736007)(476003)(2906002)(386003)(6506007)(39060400002)(478600001)(26005)(58126008)(50466002)(33896004)(11346002)(486006)(86362001)(446003)(956004)(186003)(7736002)(7416002)(16526019)(7406005)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB2026;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?q?1=3BHE1PR0801MB2026=3B23=3ANt2OV?= =?utf-8?q?gvfoUetPD4f8OLMoxW5NZ1bntV69T3elaQq2Wmq9eoBQaaBL7c6vuimeN9+Q6t3wV?= =?utf-8?q?e24UZBMNK+/6Ka5basiIZgxlDdRine99OL4Lj+yZAfvrxVQIBZalQQdS9Wzul1lz4?= =?utf-8?q?0q7+Ydsb3XujrSNj+YTbA4BtVwrTV5SGaIPA7LMyhBqQfBMNXxWlc1b0msKq+/njh?= =?utf-8?q?edgwMfphK1Jk346XbSpjfIDALqH9SYcpe5tu9QG87bSp84p6paoEeVGLvQRdD5ylP?= =?utf-8?q?RTxW+fTKwKnuRHsMiNXP5wsjPq0SRYM7Yn6VywME85KtO+UHiNN22QUcELHj/cR5b?= =?utf-8?q?MapxcbLk9eAHvsIZn6RxynivXtJDN0ytQ1kw2Fws/HrDuks1y89+1j7KTYtymH+ds?= =?utf-8?q?JZgdxOQOrzdzZi53hYmaJSoYxzRcqu6tEOHXTngCIgYMmo/88QUE0r2FOHZqyhQwA?= =?utf-8?q?Y2PESMEs1lMdtQYRM0qQuiTgBwOCiEj9qjmLl720Dsu81o8NkbQY8N9DoH5xw1GoA?= =?utf-8?q?JER/u7FOABtnPULqZApGCg5ASx2XCbyIjNffezz+1I6XgtimKh2BpxV89CLsJDPMg?= =?utf-8?q?QfDz50GAbuNPPX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O3lu5/zLGtw7DbUfM8D8M03QoHM4 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2026;20:LrQHlzuO4ScRNp+WX0KrOLhI3m17GrFfUcUmpJgpeH2Umo2/L1+eSWmRGeDp3BcbId7L32gt3I7inGyOavULUXGFiihsz6xzGcx5H91AE1fsk1zPqNreXeAlll6Q0hncBrYQeCiQ5tSXtIZid8nAqapkk0X9wmiNl7O2YV3F/iI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:37:50.5971 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 679832a7-3215-43b5-fe22-08d5fc7bbeaa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2026 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch makes shrinker list and shrinker_idr SRCU-safe for readers. This requires synchronize_srcu() on finalize stage unregistering stage, which waits till all parallel shrink_slab() are finished Note, that patch removes rwsem_is_contended() checks from the code, and this does not result in delays during registration, since there is no waiting at all. Unregistration case may be optimized by splitting unregister_shrinker() in tho stages, and this is made in next patches. Also, keep in mind, that in case of SRCU is not allowed to make unconditional (which is done in previous patch), it is possible to use percpu_rw_semaphore instead of it. percpu_down_read() will be used in shrink_slab_memcg() and in shrink_slab(), and consecutive calls percpu_down_write(percpu_rwsem); percpu_up_write(percpu_rwsem); will be used instead of synchronize_srcu(). Signed-off-by: Kirill Tkhai Signed-off-by: Kirill Tkhai --- mm/vmscan.c | 42 +++++++++++++----------------------------- 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index da135e1acd94..9dda903a1406 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -168,6 +168,7 @@ unsigned long vm_total_pages; static LIST_HEAD(shrinker_list); static DECLARE_RWSEM(shrinker_rwsem); +DEFINE_STATIC_SRCU(srcu); #ifdef CONFIG_MEMCG_KMEM @@ -192,7 +193,6 @@ static int prealloc_memcg_shrinker(struct shrinker *shrinker) int id, ret = -ENOMEM; down_write(&shrinker_rwsem); - /* This may call shrinker, so it must use down_read_trylock() */ id = idr_alloc(&shrinker_idr, SHRINKER_REGISTERING, 0, 0, GFP_KERNEL); if (id < 0) goto unlock; @@ -406,7 +406,7 @@ void free_prealloced_shrinker(struct shrinker *shrinker) void register_shrinker_prepared(struct shrinker *shrinker) { down_write(&shrinker_rwsem); - list_add_tail(&shrinker->list, &shrinker_list); + list_add_tail_rcu(&shrinker->list, &shrinker_list); idr_replace(&shrinker_idr, shrinker, shrinker->id); up_write(&shrinker_rwsem); } @@ -432,8 +432,11 @@ void unregister_shrinker(struct shrinker *shrinker) if (shrinker->flags & SHRINKER_MEMCG_AWARE) unregister_memcg_shrinker(shrinker); down_write(&shrinker_rwsem); - list_del(&shrinker->list); + list_del_rcu(&shrinker->list); up_write(&shrinker_rwsem); + + synchronize_srcu(&srcu); + kfree(shrinker->nr_deferred); shrinker->nr_deferred = NULL; } @@ -567,14 +570,12 @@ static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, { struct memcg_shrinker_map *map; unsigned long freed = 0; - int ret, i; + int ret, i, srcu_id; if (!memcg_kmem_enabled() || !mem_cgroup_online(memcg)) return 0; - if (!down_read_trylock(&shrinker_rwsem)) - return 0; - + srcu_id = srcu_read_lock(&srcu); map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, true); if (unlikely(!map)) @@ -621,14 +622,9 @@ static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, memcg_set_shrinker_bit(memcg, nid, i); } freed += ret; - - if (rwsem_is_contended(&shrinker_rwsem)) { - freed = freed ? : 1; - break; - } } unlock: - up_read(&shrinker_rwsem); + srcu_read_unlock(&srcu, srcu_id); return freed; } #else /* CONFIG_MEMCG_KMEM */ @@ -665,15 +661,13 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, { struct shrinker *shrinker; unsigned long freed = 0; - int ret; + int srcu_id, ret; if (!mem_cgroup_is_root(memcg)) return shrink_slab_memcg(gfp_mask, nid, memcg, priority); - if (!down_read_trylock(&shrinker_rwsem)) - goto out; - - list_for_each_entry(shrinker, &shrinker_list, list) { + srcu_id = srcu_read_lock(&srcu); + list_for_each_entry_rcu(shrinker, &shrinker_list, list) { struct shrink_control sc = { .gfp_mask = gfp_mask, .nid = nid, @@ -684,19 +678,9 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, if (ret == SHRINK_EMPTY) ret = 0; freed += ret; - /* - * Bail out if someone want to register a new shrinker to - * prevent the regsitration from being stalled for long periods - * by parallel ongoing shrinking. - */ - if (rwsem_is_contended(&shrinker_rwsem)) { - freed = freed ? : 1; - break; - } } + srcu_read_unlock(&srcu, srcu_id); - up_read(&shrinker_rwsem); -out: cond_resched(); return freed; } From patchwork Tue Aug 7 15:38:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558805 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 34D11157D for ; Tue, 7 Aug 2018 15:38:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2080C2A464 for ; Tue, 7 Aug 2018 15:38:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12C122A46E; Tue, 7 Aug 2018 15:38:21 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9CF22A464 for ; Tue, 7 Aug 2018 15:38:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389814AbeHGRxM (ORCPT ); Tue, 7 Aug 2018 13:53:12 -0400 Received: from mail-eopbgr40092.outbound.protection.outlook.com ([40.107.4.92]:32448 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388677AbeHGRxM (ORCPT ); Tue, 7 Aug 2018 13:53:12 -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=E7jHJUl1lc3BUVao1mtGPcK2ZJN1Fh8IXYergT6SrkQ=; b=Z9jr/qGXKvbVQDICc/oUuACt/klkRQy9bZImGLH+C/8BGn1dOW3heNsWVf+TBBg2aYmLeKc0pAWNJbvLXE7B9DbzlNDE3qUu0z5O2JjBmdBFzmHO32n+eexG7MhZWakFzKAMdagmZeqItmtBpp6PoQnelA70N3+uhjn4RRzXusw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2031.eurprd08.prod.outlook.com (2603:10a6:800:8b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:38:03 +0000 Subject: [PATCH RFC 03/10] mm: Convert shrinker_rwsem to mutex 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:00 +0300 Message-ID: <153365628066.19074.11561153370778563231.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR0701CA0065.eurprd07.prod.outlook.com (2603:10a6:3:9e::33) To VI1PR0801MB2031.eurprd08.prod.outlook.com (2603:10a6:800:8b::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f5a6071-f4d4-4df1-2e42-08d5fc7bc599 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2031; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2031;3:wC1Ak5LGoD5+LOhgASazwwFvf4+Winewb//x1LEdGx/zYiz6nvqQPCRC0drX16/LGeIU5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bHQ+k5WXrzgcA7UlJoucpVittmR7HmywO8rZUmDtOajlZVV3KChBtyqFkaHBsVwU1TNjzCkik/JhIaqtuY2WAXbMiwASn3+o1VZFqM8KRY5JQfeTG2Gb4QJIt61HXIt9IQjj78eXyc1HAIahntfUk+YLDS467LUQezltUw4XEC8kzeP2tRE08WQsxRBNPHCiQaFbQttT0qcG9fhHhKdbzagu3hHhvyLkNFgTixAYLwdRl58jMzLsw4uk5Fd6hyko522X+BV5cDZxjd;4:gT20+UFzBxMZ2jmy15wsyR2TOPPztonLA0kFdcnTzT8opka9J4xpoK+yc7hmjB4Xk76etdzRSMvyfUU1goF5uBj67e3YLMC21a7srorrR1p++wrqewig8pUefp1HLcRRIygnPYpctLAG041JdWECA/1sl4Y7ALdm6FL4yGoaCkeVn14lDuWhWZWXh+fsf6UbDUyjeJVO2/xSESRHfU6wkxPmirzNGGGA/mEb/l1xmqV7HAIzLyhrCcpLXc12uJFYfgCwrYrxXeTDLqAZyYvT1Q== 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)(3231311)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2031;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2031; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(396003)(346002)(136003)(366004)(376002)(189003)(199004)(66066001)(14444005)(5660300001)(7416002)(8676002)(186003)(7406005)(16526019)(446003)(55016002)(26005)(81166006)(81156014)(8936002)(305945005)(39060400002)(86362001)(68736007)(9686003)(7736002)(53936002)(217873002)(25786009)(230700001)(476003)(316002)(956004)(486006)(76176011)(61506002)(6116002)(3846002)(97736004)(33896004)(478600001)(2906002)(6506007)(106356001)(50466002)(11346002)(23676004)(47776003)(103116003)(58126008)(2486003)(7696005)(52116002)(386003)(105586002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2031;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?q?1=3BVI1PR0801MB2031=3B23=3Ahl6v1?= =?utf-8?q?uOcMxblEq1mpN+3TPYeMUcu7F84oFLbOqTZt5QdfOxvFWqduF4VONX/rKCUckaXc/?= =?utf-8?q?8Rl5bWMSmirSLyUsrnR3kgm2AWsoebStfSbL/21tWXopLegQd1SIEQr0UdWBhygNZ?= =?utf-8?q?1HMZo2rVWxFcQK5lGBB/rJjx28IXP0hM62SJ7Ku6EEM01eWc0baxlL4qaXYBf2hdG?= =?utf-8?q?WIn7rwLXirRE0XdQcOSV2vbfmgGKTfS3VdurnkpUrOH5C0//hpP4hWRE6BcvYVDTw?= =?utf-8?q?lHGMADz2b5s7lOKCBsK6hhz1qPxjw6d+64p8rVzC0js+LHJeHo5/qy4s9gw5bXsdM?= =?utf-8?q?5fpmCHGa2lnpSF+ksEu08JU2p1m4T0vy9OnphRnNUrwwg6vR1AUIipU2fGxNr/NH/?= =?utf-8?q?Q87ImCMJgGd0VgPpCFmdUdMomP74knNI4GbfMFX6cdW0Gg2y1kpPQodpJlC+bpWhu?= =?utf-8?q?qXn5fb1SRYZ06/wiygbPliQeJIJ9f60mZwh9wzoarNyryDyvWKXXaTVKcOkBy+Il5?= =?utf-8?q?6oYkoBc8UQ5lomqX8R8nn8bc0IkK9Z80jQxTITrgjmpAZ3aLdBw7kfRUpbiKFD+WP?= =?utf-8?q?OYwrcxtx7qmpWAOMGmAUG8dXuoCP57Nl34NtoeWO/RCD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nTdXmsn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2031;20:34l/63cvVAts2itXDdUTOURI6qSLU8yAuguthW1mWhr+Z7wD1mAcBHfqcjgXgGEOxdyfO/rCSe38a3h+N5FjW5GxyBA73jUd2GodQYgQ1AcMbiJyf64X3WDvyT0NFzUdPgKCYGb8DnADNkLBO0ufZWkbKVVN2cA5VF7dICWDWXw= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:38:03.6852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5a6071-f4d4-4df1-2e42-08d5fc7bc599 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2031 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are no readers, so rwsem is not need anymore. Signed-off-by: Kirill Tkhai --- mm/vmscan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 9dda903a1406..2dc274a385b9 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -167,7 +167,7 @@ int vm_swappiness = 60; unsigned long vm_total_pages; static LIST_HEAD(shrinker_list); -static DECLARE_RWSEM(shrinker_rwsem); +static DEFINE_MUTEX(shrinker_mutex); DEFINE_STATIC_SRCU(srcu); #ifdef CONFIG_MEMCG_KMEM @@ -192,7 +192,7 @@ static int prealloc_memcg_shrinker(struct shrinker *shrinker) { int id, ret = -ENOMEM; - down_write(&shrinker_rwsem); + mutex_lock(&shrinker_mutex); id = idr_alloc(&shrinker_idr, SHRINKER_REGISTERING, 0, 0, GFP_KERNEL); if (id < 0) goto unlock; @@ -208,7 +208,7 @@ static int prealloc_memcg_shrinker(struct shrinker *shrinker) shrinker->id = id; ret = 0; unlock: - up_write(&shrinker_rwsem); + mutex_unlock(&shrinker_mutex); return ret; } @@ -218,9 +218,9 @@ static void unregister_memcg_shrinker(struct shrinker *shrinker) BUG_ON(id < 0); - down_write(&shrinker_rwsem); + mutex_lock(&shrinker_mutex); idr_remove(&shrinker_idr, id); - up_write(&shrinker_rwsem); + mutex_unlock(&shrinker_mutex); } #else /* CONFIG_MEMCG_KMEM */ static int prealloc_memcg_shrinker(struct shrinker *shrinker) @@ -405,10 +405,10 @@ void free_prealloced_shrinker(struct shrinker *shrinker) void register_shrinker_prepared(struct shrinker *shrinker) { - down_write(&shrinker_rwsem); + mutex_lock(&shrinker_mutex); list_add_tail_rcu(&shrinker->list, &shrinker_list); idr_replace(&shrinker_idr, shrinker, shrinker->id); - up_write(&shrinker_rwsem); + mutex_unlock(&shrinker_mutex); } int register_shrinker(struct shrinker *shrinker) @@ -431,9 +431,9 @@ void unregister_shrinker(struct shrinker *shrinker) return; if (shrinker->flags & SHRINKER_MEMCG_AWARE) unregister_memcg_shrinker(shrinker); - down_write(&shrinker_rwsem); + mutex_lock(&shrinker_mutex); list_del_rcu(&shrinker->list); - up_write(&shrinker_rwsem); + mutex_unlock(&shrinker_mutex); synchronize_srcu(&srcu); From patchwork Tue Aug 7 15:38:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D878114E5 for ; Tue, 7 Aug 2018 15:38:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7FBD2A464 for ; Tue, 7 Aug 2018 15:38:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBF3E2A46E; Tue, 7 Aug 2018 15:38:28 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5442D2A464 for ; Tue, 7 Aug 2018 15:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403809AbeHGRxR (ORCPT ); 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 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);SR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PNZv9OEfbdQnT8OvW3Hv2yfqcNhxiqtbVJVKGNW00cpnEDU7H/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?q?1=3BDB6PR0801MB2021=3B23=3AMZBaY?= =?utf-8?q?NmU0Iu7APnOsxeH1zVD4fCxXvwqQrLjCz4cPcZvFzw3yHgXG+cOV5a8XuWFwwsp8x?= =?utf-8?q?UO9ZQCvESvLt894oAUfDtTNIp0z3udoUaPbjbEcEoAAWJoqyw466X9y/aQImKUNYw?= =?utf-8?q?hpLWlU1LvWSWQrV9gJtuD1hhZ+eyiTiSyR8F3SfqXuk2ZQZYqqv96K+f75Qus2S4Y?= =?utf-8?q?1cLx+C2PYmKPznCxVPgkIPeW7SJJFU5HVkmcITMme+YJOtcI7EF3TVDOs/GGcuZ1T?= =?utf-8?q?07opcDXwSew+SKrAY+I87QOTcaDxNaTD6Wb5D/RXnS70uEp/ZQzl7kdw1FfPgZSQO?= =?utf-8?q?kf47IHmqnzyCszZLbRc8cCzUEPZTmJAZhNwOu2QW8oCgXFGbfOaSJBPDGAXTiYpaM?= =?utf-8?q?jNBfQhtxP9xaMSYjT1tNAWoD4N9hiP9G6UJ7V92/kzkPKzauKc6W1gVtQp14bzkSs?= =?utf-8?q?2siz8BMorUh5M1jmO07SZkGVuKYL6NJMrcoOV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+GWUk2bNL5OcTZTNAYlHPUpNx7YjS4aQw5xZibRc9PljPw/3bH7ArScG/TgAnNcjnqGPFY7O1mZ29znRiXw9ruaNou3Io2hE6N+V75NAg3pap0o/Bka7vuImkUL0X7r0Q1VutOLP2Vpg1BAGNnZJPG9XvC+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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 From patchwork Tue Aug 7 15:38:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7BDFC157D for ; Tue, 7 Aug 2018 15:38:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69F9C2A464 for ; Tue, 7 Aug 2018 15:38:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C46C2A46E; Tue, 7 Aug 2018 15:38:48 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4CAC2A464 for ; Tue, 7 Aug 2018 15:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403839AbeHGRxf (ORCPT ); Tue, 7 Aug 2018 13:53:35 -0400 Received: from mail-eopbgr40138.outbound.protection.outlook.com ([40.107.4.138]:42249 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387578AbeHGRxf (ORCPT ); Tue, 7 Aug 2018 13:53:35 -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=rjLeLihaI+2XAryE8IBKttfF8XLlJtjoquTPBZciGHM=; b=SNitA1nHzY+fSEk9kgdqk7FWwpMkmXzOtEhwtAd0CcDs+sd9ztZR5m15PJSdfDU27KkAbnisvmN+ziOqepMIXj9iwYFbOavOKPcS9vub018J6Trn2+pZIYxfZhJrlvHMFZnGyn5uveZxzx2LhAuWG9eHoW2p3Ur8SzbsS7NCsoo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2030.eurprd08.prod.outlook.com (2603:10a6:800:8b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:38:27 +0000 Subject: [PATCH RFC 05/10] fs: Move list_lru_destroy() to destroy_super_work() 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:23 +0300 Message-ID: <153365630328.19074.5326096793225967868.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: AM0PR02CA0029.eurprd02.prod.outlook.com (2603:10a6:208:3e::42) To VI1PR0801MB2030.eurprd08.prod.outlook.com (2603:10a6:800:8b::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 535b2c34-803b-493e-31b8-08d5fc7bd3f8 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2030; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2030;3:vP4s6+o13YMo+jE4eLKJudDTNTpU3qf5LPU0PDe2VBHt0aLjg0ojRu5/V7+QBsHK2PZIoEjOxAzzj7Gw5kGpgugYwL7L3GU9ortWVwNega/CD3XOC1T66o99jtBsXe+donK+VZmhdR+oTbURZdaZiDPwZsQRqaiGrjleUlTNd5z1pXKXPGQKpeOFPNAcEPflWysy4M1aK5LvOBmLdhmyI1Cf8jjowy0ziZ3djy1BlNf9h2NidAIOEYHZ5P1TFicF;25:8yKSQzcuV9rzdACbV4nlke5ULHDs+ZbX93ih+bUrOQz/dk+qBlL4akeSlT2/mrlcXW2lRk6dbnskGC3439r32lBBmuxcN04IYojhwBOxXBiU7Lcmebr77JJw3Cb5TCAe3CHzm+JcOMlIwQTa0w/PGau3/m/N4hV3St2A1Siu/koKSItPYCjNA4QopwswkR2ShkDo1plN5zb2Nv7dCHUc+20XtIlNd56OlabdqORChLMl4NGBBYedVK7pUrgckw2RsDGipOlyTvfRnafko7IL3aBCaYWAzJoeN43xUhZe0WkOdOjWxkghthyly1xK98QOx2W7y64RpfrQHTcgaUZjKQ==;31:/f3lgy4jc5cyd+4vrLuCoXT91qEaaX+Y+mlICZBXIG7UxgBuY/xEDeT7HvRzYMJ5yMRigfRd1usyIF6YBxu6uTshDqrLQVOTUhfPOIrzdoxH50WGUQeh4GpEY0OXjo3IysOylhwYUBPhQGYYLa4TmH0JKAivliCzS31Qn6Aufl/DjBpdobmAyv6w/1iShaTnUH/+1dwZ0+JMtrWERhXhKrPn2YtWVeE8YAHHjQDgmKo= X-MS-TrafficTypeDiagnostic: VI1PR0801MB2030: X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2030;20:Bdg5aKVsoEJoGqoyQfmkr5d0uJ6D+L7+6USasHsbsCHiSYliYDmrjXevwubxlPiHT49rHjQacchrsn77R+iNwfxCaI9hYSRsO4Cp2gerNJqd9RRu5sqbQ/zIDnzLLmuD9hDMmVHELHPUJrwnWEzH//DOZ7pCTQoqdRSSyZvWKAxj1I6FcEt8oYYAuVECulODhOXF5YDpcA26D7iKnHsk1lp7tk+Po5lBl4ZEh2eYVW/bL1a4Jsw6NU+YUNWnReUphVSEn/5tpAiNQ31kJox83zHJHdCb+ymOCqn7uiweZCyIaP0qNkElIrmdu7oUgwqNCCvw5JFpxXN0mMdt/lSIjiKqCVrA+KoM3z46qoemA41rWAJuYiHrr7oI7V/z/1vT1QAwD5Uv7OvKkldkn4M5onPp2JpDB6GFKZARurpqhrnjuSxviGgRCLZaxPXiVeFqUCXZ/8PKUBFnjiGCJa/dECWvP2TmH0w0MgaJh880KE5PCok5PiGq22/Fu9OI8kPQ;4:BqeWMkVFM7T0yae1tktwRqUBS9M3hV1bjU64hfWF0nqlnY9Vy1M9Sg4mxFkLvgYOsob1QkL4bHnqYHwLhnz9846qOiudwww0znBAA4bPqy7EMrfeAjhEUpBZUvtvufSIaKLlwLDHJUPqttYAbgKVYYd7YLJcISF4jN5Yxh955mlTXMBMPoG7Ifo/9vQMyzrQW1lUi7rGR60BMmlcshu2urCVURJ/WVB8VOc2AjRinHXSIrKkzPksnlvIkKS5ExJana6uwQw8hV816bI7nu6fDeeHzt6iyVeaVZMylGwJlqJKuLXUbnWYTd10MlxiB7dl X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2030;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2030; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(396003)(366004)(346002)(376002)(136003)(189003)(199004)(6506007)(16526019)(386003)(6666003)(7406005)(7416002)(106356001)(105586002)(5660300001)(97736004)(47776003)(66066001)(61506002)(55016002)(9686003)(217873002)(26005)(14444005)(53936002)(39060400002)(956004)(486006)(2906002)(25786009)(11346002)(446003)(186003)(476003)(33896004)(478600001)(50466002)(305945005)(3846002)(6116002)(8936002)(7736002)(81156014)(8676002)(81166006)(230700001)(76176011)(7696005)(52116002)(86362001)(58126008)(316002)(103116003)(68736007)(2486003)(23676004)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2030;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?q?1=3BVI1PR0801MB2030=3B23=3AOCmS3?= =?utf-8?q?4hzyvBMfaNlQ4EDpCmflHvLibhbVc5Pk0KwLO66gb395pqr03D7sf6lUp0A1BqL9q?= =?utf-8?q?wMl9CFVaMDDLfNiLnWu1U1BkSR+lrgJzcW77PKiVczOIfQ2XllwwrrjXFToSi//d1?= =?utf-8?q?UwmpIdPnRa7nGMtvxWKAA/PA/dY5VGS2dkLYGY6+hgd/NjhlDTvmNwaOLDiRArlvb?= =?utf-8?q?ZfbHDrFC6d4j2dOyU/ftSp+E1JgivcbSaFDn5nfVhbX4F/ydAQnX+2CvYDkAd9nMB?= =?utf-8?q?zhpRyNUrdUgKOamSBgm0ndKMxvd2IlOXeMLCEc5823Mrx1HK2droRGsC8Y8/gAp42?= =?utf-8?q?llfO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YOnaHljae6ofPEwUg4pCl8dMuJQ+QWXvaeVmd5CaMUaAjxkBHBINf1bqxLw3BYd4hlRpUIjsvZRWFMCBmbqhiPJSs=;7:ZaX9nXvYn8rHdvLvK9FbHf/4jmEFhqneqFLncQ3usfoljbggv13H3QvjhXiZ6U3bIAjsv9ko6AIQHgqPfk49zV0I8YThx9a/3+NW6Rrz+lgbGZJ+DNuBvmMlNtqF0VFp1vya5B+XsfoNQhqMsogsPY+uPuRYHlVy571sWWxl3m9HUheGSOeGv1XxXyNHXFvSNZm+pRd/eVzn4EBSjAlpfZk6Lk3v7Sj3vYHvmIrUMH8Bi1nM62Rgyy4E2/1lzM+c SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2030;20:O0SU6s1e7ZO+MbBKMYnyxB3kzr6KhN7aeCoKpGJjKE1I4g18pjnB9M9PuU/pO1Hp+qLXnrV791Ce8E1F1dr1pT7FXULxUvzqlNtG4fHtt2e90L9TyAnsszpa4LrUrcfToLDmzT5SQl9xJPhOSy8NfiMAiXMHGekFQIAwDBCSGz8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:38:27.6610 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 535b2c34-803b-493e-31b8-08d5fc7bd3f8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2030 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch makes s_dentry_lru and s_inode_lru be destroyed later from the workqueue. This is preparation to split unregister_shrinker(super_block::s_shrink) in two stages, and to call finalize stage from destroy_super_work(). Note, that generic filesystem shrinker unregistration is safe to be splitted in two stages right after this patch, since super_cache_count() and super_cache_scan() have a deal with s_dentry_lru and s_inode_lru only. But there are two exceptions: XFS and SHMEM, which define .nr_cached_objects() and .free_cached_objects() callbacks. These two do not allow us to do the splitting right after this patch. They touch fs-specific data, which is destroyed earlier, than destroy_super_work(). So, we can't call unregister_shrinker_delayed_finalize() from destroy_super_work() because of them, and next patches make preparations to make this possible. Signed-off-by: Kirill Tkhai --- fs/super.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/fs/super.c b/fs/super.c index 426161360af3..457834278e37 100644 --- a/fs/super.c +++ b/fs/super.c @@ -159,6 +159,11 @@ static void destroy_super_work(struct work_struct *work) destroy_work); int i; + WARN_ON(list_lru_count(&s->s_dentry_lru)); + WARN_ON(list_lru_count(&s->s_inode_lru)); + list_lru_destroy(&s->s_dentry_lru); + list_lru_destroy(&s->s_inode_lru); + for (i = 0; i < SB_FREEZE_LEVELS; i++) percpu_free_rwsem(&s->s_writers.rw_sem[i]); kfree(s); @@ -177,8 +182,6 @@ static void destroy_unused_super(struct super_block *s) if (!s) return; up_write(&s->s_umount); - list_lru_destroy(&s->s_dentry_lru); - list_lru_destroy(&s->s_inode_lru); security_sb_free(s); put_user_ns(s->s_user_ns); kfree(s->s_subtype); @@ -283,8 +286,6 @@ static void __put_super(struct super_block *s) { if (!--s->s_count) { list_del_init(&s->s_list); - WARN_ON(s->s_dentry_lru.node); - WARN_ON(s->s_inode_lru.node); WARN_ON(!list_empty(&s->s_mounts)); security_sb_free(s); put_user_ns(s->s_user_ns); @@ -327,14 +328,6 @@ void deactivate_locked_super(struct super_block *s) unregister_shrinker(&s->s_shrink); fs->kill_sb(s); - /* - * Since list_lru_destroy() may sleep, we cannot call it from - * put_super(), where we hold the sb_lock. Therefore we destroy - * the lru lists right now. - */ - list_lru_destroy(&s->s_dentry_lru); - list_lru_destroy(&s->s_inode_lru); - put_filesystem(fs); put_super(s); } else { From patchwork Tue Aug 7 15:38:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27BCB14E5 for ; Tue, 7 Aug 2018 15:38:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15FFB2A464 for ; Tue, 7 Aug 2018 15:38:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 091142A46E; Tue, 7 Aug 2018 15:38:53 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96B082A464 for ; Tue, 7 Aug 2018 15:38:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389869AbeHGRxj (ORCPT ); Tue, 7 Aug 2018 13:53:39 -0400 Received: from mail-ve1eur01on0136.outbound.protection.outlook.com ([104.47.1.136]:7872 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387578AbeHGRxj (ORCPT ); Tue, 7 Aug 2018 13:53:39 -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=2uYe2qDeYfym+/n7FbyMe2UtdLf6NUQqwQG95QedNIE=; b=H3ZkR6BY2YtXy5QC5QYTbULVlgs/WojIMi7sbp3uqRnja9NfCXvUjkRdoXV2oXSySmGPXYIU8DrP2zxl16zTiNGAQ1OuGwgtivs0JEQyAKv/Vg/6NAMTXUarTyv9m7JJF9ojBcuYJ8V1ZlTmpg0cr3tSUw45uYKdf5TNb3Vylu4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by HE1PR0801MB2026.eurprd08.prod.outlook.com (2603:10a6:3:50::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:38:39 +0000 Subject: [PATCH RFC 06/10] fs: Shrink only (SB_ACTIVE|SB_BORN) superblocks in super_cache_scan() 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:36 +0300 Message-ID: <153365631661.19074.12075476211623702890.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR0501CA0047.eurprd05.prod.outlook.com (2603:10a6:800:60::33) To HE1PR0801MB2026.eurprd08.prod.outlook.com (2603:10a6:3:50::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 056f8490-5f05-46c7-fee2-08d5fc7bdafa X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:HE1PR0801MB2026; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2026;3:Ep2J8WJ9cstVkVfzYUct6fQuXh0K+MQaR/vRNrwpDOGF7IY9hgAwvH9kvuTRadeVLVafVBVLofD8x+87LW+W4SLXitAMMhh0uA1gjReWxOmIR/AZ/lFbZNq7R2/Ll/n80/I+BkP6/GVqD2gu7QZfEXdamfmsG6y5Kro+hBS3+cr4yfJqev56fFiqVleR3dIzVSLuw9PFzs8L1iDpXs86iKY/SKH9WgaW6LqVE3QJIR03tdNj+Q8NXt++3+XHGbzE;25:k2PMV37nlw386iO/+KBiciYAp74HxzwctN5AxYSZwF9dmyzM/uGPRFSSUGbWu8IzTtdFP42pKyzmouy8EygTmtVIzBIlj0SJNNl3e9CtSASxiXfNYiWoQsoFg4Cbg2Oq0FcT7eSHBRYencfCdbmEvd009OtrzRiXJrF+SIc/LUKvfbvqebkwE/Xg2Ysv6WCfesw2Gq65SO/IkL/5TXMrKhJySqucdFGG00UrQrEQrFTFZ/yujdfLTkAPlOsX2eVRqbxZyTRFwTfw8jh0v/CSFJQwjkMFbVcmjRW6SFkrw7wb769bfDg+fL8o6uE4CtAftagsnV5lzYqRLw42UhzhAQ==;31:rg/q8LmsdKDM/JgXMcQWzdK9u0Oh0au0/wbPRyNkTJbkqK8pk8KdfYWqWpCfmJr6cPduWJTSc8DDmoao/N3/8KKDm2OFhopEUXVNdik5B1BJsmqI8Og/DO/44saemtf8E+wAQX/t6IKVBu1HQ5WZO3RiUqHwATgIoF7vi91FhNTY0ifbSZKB+OA8Uyt8EWB64EzrCTpfpO8NHSJ3L+0N/W3ZygVPmLBybHBez3yXZvM= X-MS-TrafficTypeDiagnostic: HE1PR0801MB2026: X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2026;20:ui+ZNGRgz5CluGPYaL/rdd64PzcWJ2StIj0oJc8Zr+s41GqADXsCSK1p85U4QiJCQXd+98zR2ef3ETbzN8Sv8G9BcyOzzjMZCh7OWaQRRKeCoLv25LrD3nk38kZCcP70HQsOxyiaZWopkgbrZ6+q4p40nNet92ygrfBaIrwSUGgL/f9yjfEhSOG0Pq7ceB76mxYl2A9DZIMq2mDNsfGs4l00CoVhfeRnvJGPYVAxlv9HRMwKn7M0V7C/UXKRV5m7Y0MIGjhQutMbUG02kBAcT7ZG6TY1VSqNjX51QziJiZ8Vr/RrUkU95rfB/dROz5+8/JcASAWlD4necYwD38HRPu/FaF7x6R660Gcqq+9wAfBU4AwdevmN/JAxaIxI18H5PkDxcENIGGeQhVAxeUyuf1Od3//kf2LNFZqKtGc71L+s46VC7hw1MTqFxVD3/NRQQmRNXuTX9JG9Ryr/Ym6Tfq0tHW4nDmhYCqJggVqox+PIoxgrlJ0QLNvCilPIDBof;4:TnDtMZqUN3B1lhd6NSFHVvabknAfxBAU1c2eSGk9eD/8NmHA2NAXDAMcLBoFXUYoVnFtEv+nwXDHZo1xPG+o8p6gPEhTnNlkB8ZqDT3UjONB8j5DfvjDmWTAw0x0u8mR8cw/Rv5ClP1S+s+pLCFzEJxCVu2w2S9z1z9uF4jjgveOyJTpY94BAWVR/QNuHc9VPbqqLp96sz+hrCATe4wn/FJDoEv1dZvinvSxTQBggB43XwK3PAMC21OljiL14GNO5G7Sm4VRLjK/0VhovaBcdQ== 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)(3002001)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:HE1PR0801MB2026;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB2026; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(366004)(346002)(376002)(136003)(396003)(39850400004)(189003)(199004)(386003)(2906002)(6506007)(39060400002)(478600001)(58126008)(26005)(5660300001)(53936002)(305945005)(68736007)(476003)(7416002)(186003)(7736002)(7406005)(16526019)(11346002)(33896004)(50466002)(956004)(486006)(86362001)(446003)(106356001)(230700001)(25786009)(66066001)(52116002)(47776003)(14444005)(7696005)(55016002)(105586002)(23676004)(2486003)(6116002)(3846002)(97736004)(76176011)(61506002)(6666003)(316002)(103116003)(81156014)(9686003)(8936002)(217873002)(81166006)(8676002)(83133001)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB2026;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?q?1=3BHE1PR0801MB2026=3B23=3A/Cf5r?= =?utf-8?q?QeRqQg9SjVZrooVhev/h+n8AIQ4g1brn5AAUqei+4W33v7D5sG0ncPM6HWLHC21Yu?= =?utf-8?q?0pTRRsb2NUWbbyyU4q5hGRd0tZmamiTg0keWnHuByBNWog7ZFIFp5XbCXo5VzoqWe?= =?utf-8?q?8hAZd7apfkWEWHeUGqJZltN3Ku7gmmw6JRcvJKGztLbQfop7wbtX5F8ddPqkkSaSZ?= =?utf-8?q?3I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hfK+DNNrgdFQ3RFeuRwTcop7+1vlAHMouRLS1qwiPjUm9BmOu/BfOiryloRtu4I39+sJCJUXbyRzGyj4rcDl7gxUNzgHlXA4tLNPGIseyk+zvvAVJPAKAjcIGrZF8WEmGMTJcU5iC3vFKvA==;5:B2o9mc8KPmezlAx3CgCGxIJXqW0GgifaCZxwb8He5momAlqlK5FDRq9Zt0Jiyi7C7rLI2viEJjySQ6YNS824QM8M2xEG7ZLhhgpJYkPUgj1coZX4t1blFKglNCCM0v3yG7VZ5qfhkseRrkBTW7usNY5ffu9Tcatzze/OmC/W2mU=;7:NQkJ8HTTMTtNa54/V7IcTxMCqwHpRlC2Nv0HmOrqQTXKnkSqBKfwK8/TaofGJuMyIAGqzgo/qzILAJcUaD/8x5kdApHTNxUBXQ35sTXGj4jvjc5tskzjjN+L4UAf80TknrBFnSlRErpV8G4CYrAy5vzXS+9e5nCXY8otUYUaVN4RC6Ex7z2usuFuH6oWYullv3nRzrkMephA3lBaL4MFjWfHVBDjQ1GvtSg7vtCV5s1hWyiCVq6dLxVEOiNS05yu SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2026;20:em2/RxsE9Sx2dneLAl/4rA2Bzjcuc7IOmvxmOSmXBP8nDMG5R6q3mZ5D0oRcIGBJZd83ljUI6CZY5ylJpm8BYceaORhxZf7oIkh+8nRDggOMcDovZNevxOcLRL3TJGaN9zbCW46uRcLaCBuMpCF++BMTXOdI0s9RxnkqbLK/IIs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:38:39.2227 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 056f8490-5f05-46c7-fee2-08d5fc7bdafa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2026 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch prepares superblock shrinker for delayed unregistering. It makes super_cache_scan() avoid shrinking of not active superblocks. SB_ACTIVE is used as such the indicator. In case of superblock is not active, super_cache_scan() just exits with SHRINK_STOP as result. Note, that SB_ACTIVE is cleared in generic_shutdown_super() and this is made under s_umount mutex. Function super_cache_scan() also takes the mutex, so it can't skip this flag cleared. SB_BORN check is added to super_cache_scan() just for uniformity with super_cache_count(), while super_cache_count() received SB_ACTIVE check just for uniformity with super_cache_scan(). After this patch super_cache_scan() becomes to ignore unregistering superblocks, so this function is OK with splitting unregister_shrinker(). Next patches prepare super_cache_count() to follow this way. Signed-off-by: Kirill Tkhai --- fs/super.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/super.c b/fs/super.c index 457834278e37..9222cfc196bf 100644 --- a/fs/super.c +++ b/fs/super.c @@ -79,6 +79,11 @@ static unsigned long super_cache_scan(struct shrinker *shrink, if (!trylock_super(sb)) return SHRINK_STOP; + if ((sb->s_flags & (SB_BORN|SB_ACTIVE)) != (SB_BORN|SB_ACTIVE)) { + freed = SHRINK_STOP; + goto unlock; + } + if (sb->s_op->nr_cached_objects) fs_objects = sb->s_op->nr_cached_objects(sb, sc); @@ -110,6 +115,7 @@ static unsigned long super_cache_scan(struct shrinker *shrink, freed += sb->s_op->free_cached_objects(sb, sc); } +unlock: up_read(&sb->s_umount); return freed; } @@ -136,7 +142,7 @@ static unsigned long super_cache_count(struct shrinker *shrink, * avoid this situation, so do the same here. The memory barrier is * matched with the one in mount_fs() as we don't hold locks here. */ - if (!(sb->s_flags & SB_BORN)) + if ((sb->s_flags & (SB_BORN|SB_ACTIVE)) != (SB_BORN|SB_ACTIVE)) return 0; smp_rmb(); From patchwork Tue Aug 7 15:38:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558821 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E703E14E5 for ; Tue, 7 Aug 2018 15:39:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3DAF2A464 for ; Tue, 7 Aug 2018 15:39:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C622A2A470; Tue, 7 Aug 2018 15:39:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 627C12A464 for ; Tue, 7 Aug 2018 15:39:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390051AbeHGRx5 (ORCPT ); Tue, 7 Aug 2018 13:53:57 -0400 Received: from mail-eopbgr50090.outbound.protection.outlook.com ([40.107.5.90]:43008 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387578AbeHGRx5 (ORCPT ); Tue, 7 Aug 2018 13:53: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:X-MS-Exchange-SenderADCheck; bh=Bz2w5fJXdWqMn1oOXDA+rfsXW/U99Vf7ljx+Ic1im58=; b=g1KuV9IDx/Z8Q7e7z5x6BW558qmx4dGjg2apJXJkmqrQKp1Q4ncWfHUHuiOmf/48ejsmWh1/672OTERGcXviXkMxhtUXxnqkrcuIrnkqahbd47kN+uYZiSIrzLOfrDLXo/MdnGLtVgfu23/FALRxrMz1ePUCTGgfz1PEJXt0pTM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2032.eurprd08.prod.outlook.com (2603:10a6:800:8b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:38:55 +0000 Subject: [PATCH RFC 07/10] fs: Introduce struct super_operations::destroy_super() callback. 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:48 +0300 Message-ID: <153365632811.19074.14026254201855676335.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR03CA0056.eurprd03.prod.outlook.com (2603:10a6:803:50::27) To VI1PR0801MB2032.eurprd08.prod.outlook.com (2603:10a6:800:8b::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fea4c23-9e09-4c58-c4eb-08d5fc7be4e8 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2032; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;3:AyMVy+6dGfOLA+zlBNLanKxbZ6YX0DxTnIci3l3kNDxmn/Xlzv4/t0QHVW/Ycs28tpOgkgUyO2P2dkYqqa1wrpZnNlS3Ugw+DQHFXtXNJfhdXoznPQfd8w+ka8WoyvtnQpddTRgJ0qfMlJ7FjiV5SWXPK81Ec0tl7hf3TS1bllxCabNPu2kUb4eVlvrO+WPoYYnUpoIYKACH/Z+wX3RZUbVokj6SFnRr9qbYgAxuT2c/gNQ3nQD2mB6AOP8GRUd2;25:7i+mB3K3yz1iqaN8lOW278iliL/ObXg8y6eNeavKR4HFyIXoJRqhAWFRrXwQN4MNP/x+MALZC2aDZ6WNmGfI0nyKi6CDDF0TH0uvlpZeJndIHKThZBdi/YxBZijpCjwBtRd2QzTvY8urcOGisE/uGB5v3X5I0t4SoJKf8A1fqTW1kwoRDJnkshq05FpbxTfwyxJrA6VsHpXk6S5kH/p6XNIQh0gxqZCtHKSUXfbseKZAClpRWSUMsD5IWaT0xUu0ei6TJiyYmObSo+x7t+Iwks5KVtBW74dnOSXmVFlWxnxtTv0FGGITDSmfn9hdoEW1w0fBFkfsj3JyggjeM3Ptmw==;31:vj2N560yOsvJxJzKEeJg64YdRw2/B74IUx2T9eglukKW+I1OEmcp+LDKsa73iZxAoEIOXt0qMb5W6xtDSagpk5gwnGerJqDVAgfvGfj1vjb8R27XyGdejEeezoX6SdwSqaP8n7WgRH6lDCGKXMs/T/Pc92fXSq4g1lJvPHw/RLzjkDyO17mZ+dFls+wdgW6dZeW1QllbMbk3dFN0gscqdZyGjCf3gGj2sxtcjF44VLc= X-MS-TrafficTypeDiagnostic: VI1PR0801MB2032: X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;20:9rXmBI09PKWjgywaJNv8ft9Chyq/tJqvJLrzztOz566hQstUMpCL3FZHFvSY/cMflkhLN48Qk0GRCVuAF+RtsMMGa5mBoLPG8ppai4SOrvqniq03LwHL2VPn2Zvrr9/p8NfkB6coUN75pmdScGZFiNRxgW7wfQ4nJbYRprka4To6pvccZ4WWc3+QV7q/d/uokX20e5TQhZReSGF4wV18ZdcurEQMvZ7jK/PwVK25JirVbsEMLKH8jCFWvA2aWgSuRuDl2iBVyQM2YFhFDMeGv7lKPSS0xkSnarA8VfX5ZMadTtAYeezANB/vWhQhu5IXqbvfQo8oQRWegUSAWfy41hPTECNqwaZZ8xmzuse7n7rUwJ9ggUb3jC+KVrGAgmNnatAWCCEj7y4W4hwTndbA17Lku3+h1pXaLw0O+o3sh0FHxT44V+cnIw00YxN8QvU6crYol49RTRKbp8tAgnO/HhPqhyEI5hhrqiiReRxp3errQJ+z5SS8iXHy/qzLxsrQ;4:Pa7mqx1X6+Kd3v9Q7M4jl90VZ5yRr4XYUzn6pjLqgWiJbGtL62mbvVKenz0CIMebd/Ojr7eyklUfGJRQrfYlG1rd+5pixEXDqzYusfDrqpQdAMwDKdrMJb/qQg0FLDhc/Mc9SMoYL/UVe1jAaWNpwbLePeVBsifTKjtG5RrowRNyHX6AyPVsybIoWKVk88Ge+xJsgQSt7vK2p560jxCGRrsAVjKf/6mF5e0hBHQEVo+SKYxyO8hrpCmAhTUsxabWbNDMRJaBx9/cbctUi/HSjw== 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)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2032;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2032; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(346002)(366004)(396003)(376002)(136003)(39850400004)(199004)(189003)(106356001)(105586002)(217873002)(956004)(61506002)(66066001)(486006)(478600001)(11346002)(446003)(7416002)(39060400002)(7406005)(26005)(186003)(6666003)(86362001)(575784001)(97736004)(230700001)(476003)(5660300001)(16526019)(6116002)(3846002)(53936002)(103116003)(6506007)(68736007)(386003)(305945005)(7696005)(7736002)(76176011)(81156014)(8676002)(81166006)(2486003)(23676004)(9686003)(25786009)(55016002)(47776003)(8936002)(50466002)(316002)(33896004)(58126008)(2906002)(52116002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2032;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?q?1=3BVI1PR0801MB2032=3B23=3AGnUgD?= =?utf-8?q?5kMD92HHpmpX7f1TxMKX+M8QJbCvqjfoCASxf0iRImahTTP5J3e1Q6XwpxLsgStB2?= =?utf-8?q?L1hQ48NkbMVkcZjl/HFVRf2D95fg+Qp9AAzhvRwIsXFILrRrF0zhmP2/90xrfFfbP?= =?utf-8?q?jb3C2EBwZyi3bLuU53mCTeiWQUAp2o6RbKBSaCO6VGzOmE33TRdGe6y2IShrAtods?= =?utf-8?q?ROzHtXyE3wSZGDlzLtZFw1VBMo/2gV/mlT+kdeOQmvhOIbe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JQ2eNQftohc+tIMePorvhVp/TozdTp1OqFksqDg==;5:h8XaS7IoNmTQJsHQYEFSt826TE5ctqmFbkwixP76qkOvgvBGp5D/TvpeWWoxODJYPUcCPSyGbcHDZYKgzuWPQqfN9iSLa9usFV7GDG4xlkklLzoOV8eOCVtfvzWvoCgfrXpt4t7+36nNEU2gfBcsRkO4UBmwZEjITI4nRMbVhLY=;7:wOGYVhyOpN/64bRXDkgPFn1honJYNFjp8kyoRPncZaeesY+WERxlUfHOzNgNfdBF2ZfKZzPayCy29mlEYBeW5XkdLuxX1Khwt9JPyzf7mBKL6AV7hZKbMWg7F2RSaIgA2+ZRyBIL44QNYkWLdftrImiLZl90OvX3paV/oPvyGN+U42L/g6r2b0uROo1bSPrb5lUPBNWI2zkCBNP9f4i5NHVERBT80+yJgiokl7hImF5jihaE9goG/vSdqmHuOAFO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;20:LqLirqxTPbI5EkhYC25qng7zxJqHDgngQ35x/ExQi88oH59ErfsezBZeYyHW7VLFPpsC0ST1qfuzJ/O5r1RYenqQV6byLdI1Oyvp3ETQms07mD5YSiOzkr0mk2U0G2n6vqeg9dO1TyKgRCHzbBaYkA2MwkNrJ+iVxTZVYskuHN8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:38:55.8789 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fea4c23-9e09-4c58-c4eb-08d5fc7be4e8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2032 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch introduces a new callback, which will be called asynchronous from delayed work. This will allows to make ::nr_cached_objects() safe to be called on destroying superblock in next patches, and to split unregister_shrinker() into two primitives. Signed-off-by: Kirill Tkhai --- fs/super.c | 3 +++ include/linux/fs.h | 1 + 2 files changed, 4 insertions(+) diff --git a/fs/super.c b/fs/super.c index 9222cfc196bf..c60f092538c7 100644 --- a/fs/super.c +++ b/fs/super.c @@ -170,6 +170,9 @@ static void destroy_super_work(struct work_struct *work) list_lru_destroy(&s->s_dentry_lru); list_lru_destroy(&s->s_inode_lru); + if (s->s_op->destroy_super) + s->s_op->destroy_super(s); + for (i = 0; i < SB_FREEZE_LEVELS; i++) percpu_free_rwsem(&s->s_writers.rw_sem[i]); kfree(s); diff --git a/include/linux/fs.h b/include/linux/fs.h index 842fde0f0981..33dfaed0a01a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1880,6 +1880,7 @@ struct super_operations { int (*drop_inode) (struct inode *); void (*evict_inode) (struct inode *); void (*put_super) (struct super_block *); + void (*destroy_super) (struct super_block *); int (*sync_fs)(struct super_block *sb, int wait); int (*freeze_super) (struct super_block *); int (*freeze_fs) (struct super_block *); From patchwork Tue Aug 7 15:39:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558825 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9183814E5 for ; Tue, 7 Aug 2018 15:39:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 812562A46E for ; Tue, 7 Aug 2018 15:39:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73F942A471; Tue, 7 Aug 2018 15:39:24 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13E712A46E for ; Tue, 7 Aug 2018 15:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403854AbeHGRyL (ORCPT ); Tue, 7 Aug 2018 13:54:11 -0400 Received: from mail-eopbgr80114.outbound.protection.outlook.com ([40.107.8.114]:45240 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387578AbeHGRyK (ORCPT ); Tue, 7 Aug 2018 13:54:10 -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=ZoweZLAYp3KgFZo2uGoPuYqg3viLGocWgESzGgqHXy4=; b=ehEpoLACvT4MSoIHIof2+EnXIgtOW0VGWaEzFeJR2z4akYSCS3lGlHBQNA9ghHD3vCpGm/GZOCq8KQXRjpgVNE5aR6R9WJfJcWbahEu2jKJOKaZlnMguX3slyF+QpRr5Rgzg471MrO0tUMo/1xDf7wTgclClBwOoeHOOTZPe2zg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2029.eurprd08.prod.outlook.com (2603:10a6:800:8b::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:39:07 +0000 Subject: [PATCH RFC 08/10] xfs: Introduce xfs_fs_destroy_super() 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:39:05 +0300 Message-ID: <153365634503.19074.14972123229522734895.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR0202CA0034.eurprd02.prod.outlook.com (2603:10a6:803:14::47) To VI1PR0801MB2029.eurprd08.prod.outlook.com (2603:10a6:800:8b::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8580e0cb-9690-4303-228a-08d5fc7beb38 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2029; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2029;3:bKv/zYxfBTC32Bt4PdjDxkMDGkiEuoixu3UgMGspvfJD4FrUXQDu1xUrr3OJGRXSXbcH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F77sUWwdvk/u5L1cbrs6o+LeTN+BvK836wQdei2MzbkQmOQDreUnIKE0FJ4dZZQ9d533TSA9BbtAwN1xSYxHAri+3nHVIjR6tdIYXF1BWST2WpiJ7a3lfwGq04K8CVndbXYyaJZtP/rEDieoLrnPIIKv5kmz2IDF7/3cJUg0IeNQsU/E1CVtvHGFuqrNudf146OBj+8e97VZNxFXtlVEPcuskTmiHwZyWjxNMWKVkR5PDy5jkERLOhRtdDBhZ4fsg9cXSPKSHBKJYVcI6kJOywr4sxKKB3SjlO;4:fo3mvZA5p8bXyVx+BwDz9KJ5RokYwm26xEuW9P8xol1kPPyuCgsEquT1xZiOa6SWlcIiDVH41WSJBpSZljicUMbQWhtrJPDLTrN7UcRZTZyinVOAEfeJbksMLhEcG3nYDk9YYfJJEAhNJt93R+ZBRwdGSL/1Yzj2g/JSjZUHb23Q62rauVHysTfN8mVDMk6vYATlB6MgWvFsyFMsBVJozZQg7E65GA056NdFvXyZpOXzQKFz1arIXO19vGTGqOZ6m5YgLW0H/bP2leDxnZJbpQ== 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)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2029;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2029; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(136003)(396003)(366004)(346002)(376002)(189003)(199004)(486006)(230700001)(53936002)(86362001)(11346002)(956004)(2906002)(5660300001)(476003)(446003)(14444005)(7406005)(7416002)(16526019)(186003)(26005)(55016002)(217873002)(3846002)(9686003)(386003)(6116002)(6506007)(8936002)(50466002)(478600001)(23676004)(47776003)(81156014)(8676002)(81166006)(103116003)(68736007)(58126008)(316002)(66066001)(7736002)(105586002)(52116002)(76176011)(305945005)(7696005)(2486003)(33896004)(97736004)(106356001)(61506002)(39060400002)(25786009)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2029;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?q?1=3BVI1PR0801MB2029=3B23=3AtLspv?= =?utf-8?q?pg725frnoozu+jchTvwn5IhWezARy2DQAWX+DhMLUABWBg9qjRqLPL5q0m7Mcvb0u?= =?utf-8?q?tQRQVEQnfCLqnUxXFnjkFSpqFQSMznij70BaElLDpdkNGAyziz7m464RbkvM8aiNa?= =?utf-8?q?9N3sCJEJFWaBc6n13dZsXXW2ux4gSUIIcr3LNnUkZWDqxUIQhZueUBlYy3PijXivm?= =?utf-8?q?clHd6OcYruquVTL1qnqbTvzp6PnGywBQe6TMwAt6Dy+aZ8rHTokxVpLXbUlq6xor0?= =?utf-8?q?JT5XyTb7Ir5liOmYKLbjlkjMAl3swqEgE4tiA49maE87C2pojeE1QIb94l6Whm/E5?= =?utf-8?q?5k7QXPJXevHTCcvX6Ilu1ONZH0x8GTlxCcKaZZzxXBOF/YpNS9+ige4i8PanRUnWL?= =?utf-8?q?M4k+l0oKGMk6zRlgmzAMWZQuBgaEjMO5G6q1T3V7uCQDyyuuigQHtLqK6h6nGGbWW?= =?utf-8?q?FdXEbnjwEcrTL98ato314w1z0r9LtlEVjTealdYWazh5+sbUy1EdYEjhK0+5U7iwI?= =?utf-8?q?Imav4LfWhpm+FhO56rh9HuaUfkRXZD1kRRvFFHJndSDLsqetqvXcPLZjNRXHBieuH?= =?utf-8?q?bWtabbb5W9ark3qcTFgcoEKR7+BNmF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nfm7KJ0vcr06Sp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2029;20:wzUR5MiLoJ2LdUk+9fVYX4n+qfuvA4cgzDcC7Sjtjo+CMtqqSC9P6Y+QP1MyrxGYFbjS7sgEEWnQuL31k1L2VdqI5z3MltTn/hZeREMTUZNeD832GAm+x426hJ2s/r/hviy8OHid2h/VA/CX/IkjKj23YxsvdRlH2P8gg9UKBXE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:39:07.7794 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8580e0cb-9690-4303-228a-08d5fc7beb38 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2029 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP xfs_fs_nr_cached_objects() touches sb->s_fs_info, and this patch makes it to be destructed later. After this patch xfs_fs_nr_cached_objects() is safe for splitting unregister_shrinker(): mp->m_perag_tree is stable till destroy_super_work(), while iteration over it is already RCU-protected by internal XFS business. Signed-off-by: Kirill Tkhai --- fs/xfs/xfs_super.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 9e2ce4cd98e1..c1e00dd06893 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1774,11 +1774,20 @@ xfs_fs_put_super( xfs_destroy_mount_workqueues(mp); xfs_close_devices(mp); - sb->s_fs_info = NULL; xfs_free_fsname(mp); - kfree(mp); } +STATIC void +xfs_fs_destroy_super( + struct super_block *sb) +{ + if (sb->s_fs_info) { + kfree(sb->s_fs_info); + sb->s_fs_info = NULL; + } +} + + STATIC struct dentry * xfs_fs_mount( struct file_system_type *fs_type, @@ -1816,6 +1825,7 @@ static const struct super_operations xfs_super_operations = { .dirty_inode = xfs_fs_dirty_inode, .drop_inode = xfs_fs_drop_inode, .put_super = xfs_fs_put_super, + .destroy_super = xfs_fs_destroy_super, .sync_fs = xfs_fs_sync_fs, .freeze_fs = xfs_fs_freeze, .unfreeze_fs = xfs_fs_unfreeze, From patchwork Tue Aug 7 15:39:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558829 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49D3D157D for ; Tue, 7 Aug 2018 15:39:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 387462A46E for ; Tue, 7 Aug 2018 15:39:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B1132A474; Tue, 7 Aug 2018 15:39:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF5742A46E for ; Tue, 7 Aug 2018 15:39:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403873AbeHGRy2 (ORCPT ); Tue, 7 Aug 2018 13:54:28 -0400 Received: from mail-eopbgr40095.outbound.protection.outlook.com ([40.107.4.95]:42858 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387578AbeHGRy2 (ORCPT ); Tue, 7 Aug 2018 13:54:28 -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=Bg2f3sHd7KK1BJ0cbD1TUjK4ril0zWlzMyWwFzFD/WQ=; b=GPDr44Tnx7Yz3WjoerHJjJryCK0MChpRbchqf77gkUN6D8LAZ2YKv6rmMjRvDX+s+yP6gqFb0zzQuVTzgNkKcwuJM5gKViHBb1W16gePdhvxuzGjJcm53nd932zGwto9XD+SxH0rQsl67Jx0qxCSlZDsQKyEBQVLTw8jTIIGujc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2030.eurprd08.prod.outlook.com (2603:10a6:800:8b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:39:18 +0000 Subject: [PATCH RFC 09/10] shmem: Implement shmem_destroy_super() 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:39:15 +0300 Message-ID: <153365635538.19074.16684830171993560909.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR05CA0133.eurprd05.prod.outlook.com (2603:10a6:7:28::20) To VI1PR0801MB2030.eurprd08.prod.outlook.com (2603:10a6:800:8b::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 227d3eae-996b-4c9c-b285-08d5fc7bf261 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2030; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2030;3:wM4LiZZYmPpTsig59tCi4wpjdUT3odeDnfEGBKsWz5WF4G+bWqsuYLHqY5LdROqkcFI4/bxITEFE8eqytlbvDSM/j7f+vZrh3PZkl1FBy01h6JRqZSsqFEaeTSo1BC3Ne/EkWu0PDcvb5mzWCCRCULqiFne6LwdkE+AkaFAjjyBOBHN9UOr2kxAHHRbGCNxq8Vxk0r7JX/HjTjYtvMNRij6fWZ2zdKgBrMx5kLl/QmEupQjrdCMrqNPa8mZxxSVH;25:bKwWAaq8kv4+WK9LK1WsoYwRa5hmjaUstAATuQElWrLeSV3oPzL4NlCOtev15UvC6y1IVvhSsuJauXx20/fJs8W09m3XmHcRSWNFitn1zKcxvqLpFU6TCPUmwRs7wf3BDBtwmkKwCvg6b4PNamBQsXTbPKbimQC0YTq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yijhN2CIPmH2Jv3EVFZuK4rSFG+VfCgXSLwUeueodHg4Y9Mi6LP8MwPcPV25LADSWEfTIH70LmJWyB/xtO8l5uUJVJktsk0hyy6rjXJh3sUIk9sf2cD/LIfrmelz3rRgTyCdpaHIltQPHnJ+QaF9SZiitJuU+LjqYJZ9Vzczw36XhdpIuPWFGrkhmB5M82YZbYw1zARfQ== 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)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2030;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2030; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(396003)(366004)(346002)(376002)(136003)(189003)(199004)(6506007)(16526019)(386003)(6666003)(7406005)(7416002)(106356001)(105586002)(5660300001)(97736004)(47776003)(66066001)(61506002)(55016002)(9686003)(217873002)(26005)(14444005)(53936002)(39060400002)(956004)(486006)(2906002)(25786009)(11346002)(446003)(186003)(476003)(33896004)(478600001)(50466002)(305945005)(3846002)(6116002)(8936002)(7736002)(81156014)(8676002)(81166006)(230700001)(76176011)(7696005)(52116002)(86362001)(58126008)(316002)(103116003)(68736007)(2486003)(23676004)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2030;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?q?1=3BVI1PR0801MB2030=3B23=3Al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zwb5DvY5ocxxzthGe36hJ6qSYvlNHn21LKfC/lmnBLSf6AwXENqWISoHbLxuXPleSes4vJM6yWNfdCBtB8/Ohc4gzQTZxOsU3q1f33QZbLpZvSZW8EhwIX3ysSvD9aY9uIid89n874gNV6km0t2jYx75fwN14LFoWrq1REQY2Ep7nkocgrcD41RGM3ea6cUP/jVUEYmzwiwyrX+QAZaL0pfOEP+mWRB3DsyTdc0/MtfQ0APMXh9dcMOOak3OKDnqnb8B+RUZrJwOH4aYAWDDQL7E5iwMWkGt/chCHEkoCPocaBixi/2bCkCMgjlrqu5qs38UFiSvxS2Ajf8oDsO3xub3ryTfiYtILVhL9dw==;5:CpQuXvE8xTcsfZ4IMwhl7D5YWXyI1WpzBN5lQRAGn20a1VALOQ3Wq4cXJlIMGEf33thUNPKWwBOTglgZz9RyRNiUmv2YqPvIuMWW62NGrJpos20UZKvES9n9RbDn0WHoVjFpnPUNQRrhbVSk3RKvffe0zrcmUgUTQsCHhSrn2JU=;7:I135MyI5CPpmz/JTWjOuLXG860YuRDmOMpHtmYFHf/2Vvp6x6ZpYkjOjepoXZOWh3CIYOM3drkVj8duRjTOG8FFMmMlgZwP76gYsXX9e2zFe2TI8zCbtWaYvhMuBzIAde9/w5AFhFJB4sXshMUFQXtQZiL4O3ZHTaYfg6Fb0zfxoiUmQHp3US0JLEA5y1iBtgb6i4NCoCSYtjo5DqRNLMhoBaR9XQMcVk2hzZJUi4sY1LZQtXls12Ez5cLETFz9B SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2030;20:KUpAFL/t1fg1kF2U4kWOfITPEQD3vyA77xqygMc8Z+tO3yueNozCEpcbYEM+qcqBSNlpWHL+1ERWINuak7wEE/oUhVwA0WGGY0zTXAX2iMr3kquf4ERoWG9SCvSAErGzhJSBqLlQ46PNMN3PiADRrn/0YgRWiXgT+JQPZVmUpEc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:39:18.7221 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 227d3eae-996b-4c9c-b285-08d5fc7bf261 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2030 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Similar to xfs_fs_destroy_super() implement the method for shmem. shmem_unused_huge_count() just touches sb->s_fs_info. After such the later freeing it will be safe for unregister_shrinker() splitting (which is made in next patch). Signed-off-by: Kirill Tkhai --- mm/shmem.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/shmem.c b/mm/shmem.c index 4829798869b6..35c65afefbc8 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3427,6 +3427,12 @@ static void shmem_put_super(struct super_block *sb) percpu_counter_destroy(&sbinfo->used_blocks); mpol_put(sbinfo->mpol); +} + +static void shmem_destroy_super(struct super_block *sb) +{ + struct shmem_sb_info *sbinfo = SHMEM_SB(sb); + kfree(sbinfo); sb->s_fs_info = NULL; } @@ -3504,6 +3510,7 @@ int shmem_fill_super(struct super_block *sb, void *data, size_t data_size, failed: shmem_put_super(sb); + shmem_destroy_super(sb); return err; } @@ -3630,6 +3637,7 @@ static const struct super_operations shmem_ops = { .evict_inode = shmem_evict_inode, .drop_inode = generic_delete_inode, .put_super = shmem_put_super, + .destroy_super = shmem_destroy_super, #ifdef CONFIG_TRANSPARENT_HUGE_PAGECACHE .nr_cached_objects = shmem_unused_huge_count, .free_cached_objects = shmem_unused_huge_scan, From patchwork Tue Aug 7 15:39:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10558833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 066E414E5 for ; Tue, 7 Aug 2018 15:39:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9A2A2A473 for ; Tue, 7 Aug 2018 15:39:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD8A82A475; Tue, 7 Aug 2018 15:39:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EBC32A473 for ; Tue, 7 Aug 2018 15:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403891AbeHGRyf (ORCPT ); Tue, 7 Aug 2018 13:54:35 -0400 Received: from mail-eopbgr50103.outbound.protection.outlook.com ([40.107.5.103]:39506 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2403889AbeHGRyf (ORCPT ); Tue, 7 Aug 2018 13:54:35 -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=NpY6Q6iqU9qbYbRcjvh1dP1lXspTE+mMdqm0dAmnulA=; b=bh3tIYe7mn/XKikdX7iPR4xUD2MqA8MwCRVFQrCi0LAxqodUptKjcnpU8YTD/krgYhFe0R89zX1jhKF4SvX1px8WzVgWX9neRmYDWxF5yvak4O9oFd/z9mMbiV6yWk8Gik97Ncx0pJngRQjy3usFkpjqa9o2yo9Bxt/SUkQmTI4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2032.eurprd08.prod.outlook.com (2603:10a6:800:8b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 15:39:30 +0000 Subject: [PATCH RFC 10/10] fs: Use unregister_shrinker_delayed_{initiate, finalize} for super_block 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:39:27 +0300 Message-ID: <153365636747.19074.12610817307548583381.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 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: DB6P193CA0016.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::26) To VI1PR0801MB2032.eurprd08.prod.outlook.com (2603:10a6:800:8b::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7a61e6cb-96d1-4380-78ae-08d5fc7bfba6 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2032; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;3:4wpi8thsO3hOYWfZpFCW84iglbdEDdwzm1tkrdT5jhMCXzH7pqBkjpx9FUdCSM7wdCwAMTPpwOVmD5mrGSDQnjY8YzrTu2eclUc32KAMH5I3WXW8tnqz+krii18pMuX9QTQY3UUaR+0InJce9bqGlEVMIHxlSxIiq9OV+BgF9u/GqAKhuAUTG6YVpF2PCeWjdSl3+h9y1ku0F043z8mxYDX2FA0xLyK6qrf2kMWX+9AMp3FSwkh8dv/zrORJA4ta;25:30igJ9Zj39XwMENlc/Wr4zBKarlPlL+ki7yBJZ5MpWc4C5K+R+Eyv/b5huuBl68+ZcTHICIyFVvaPmIO96Die4rjAO13Oean7Opntdm0YEdZvwG7Mg0AXvMbcIPY9wOdgPhHkLKNxAzRJrye1+WHRfd1NgAMMGwHoci83Augxc2sZZRGydkK2b3MoHKccQWM0vLl1SIJP/JdONd5z3k3hpR6oHBXwfaiR80SwEZb1oMhTcRJ7UL7Xudpahtu7TroAnQksfEcM0E7brrb2GdaoCTveNWvpXZkzwK2NUWTqtwGPjUh/jiq0vtHtAChfy/pfs5hYyzGYXdD4bpOwERNSg==;31:zD87Tdjqd2LYgqEvopkz01NJpLA0l0YJIj2m4wRdefSVJhoNaBwuukFvKDAIZgKzNgdqNot8C6fov/sni4psZbs/9siLfQ1uCyY/+oNZX3EKA1t4906Gye3ODAa9P4DOfaZOOXmHMvSaN4M8vtAhKlLxLk7Ygu2seVzG8wemR13L/tU7fjAJQjZYkCyu9sbntra62Wfj4D6Fb2G6NtVQrcaDU4U1OeqHgJGHKqbtXQQ= X-MS-TrafficTypeDiagnostic: VI1PR0801MB2032: X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;20:/d/sN/+3ss50XhiEZ0vw2n9cmjK28wcVZjJZ46Vj7m66U68fkvba9HUAQ+dS2EIapV3vwU0Hs5lsPwB87lfURIc5Hcz1umsutZEiPIEIO52GydkQRz9vQr2jhJo5+pMCpHthV1YBne4kgYjVOr3tItXxuK2SRumv5rmarQ9jTV2qK1+TW8VGUXwlWrk1cBA8WUTeR+073nYlzYJG0A/mqQCap/px6liekkM4U3lmJTnnx83+M7uG30J7/4+S3W+wO+/FuGXwoZ+FYMQIuU3LgWthfrz+jhSaINA9kpDvmHxuuP6pfA2GHXWCrlXY4/AQMkXV0j4IyGp7CiDtjybQMtD+Ffygfd7/A9VOa/cxHIDnrY84kJz7jKliRrVcDgX8Q34R7qJElTWvwuAuOolNHTQaGkIKXK8KPy9wLPXYbSYZfDnStcBlKumN160R9anAfYcDorPzfloAG5QFSjgQgvgFH/sh+1nHjiu4M+99P15x9TYUhGLT62BxUxO1exTw;4:QY2iMMUw1DCZlJ6LWfSrn9WrUDOHP9rTwRL9inc9n5MSaaFugn2MHKkmPIH7b2K6ZIt6isLRjRF/idra1X0GUADv9rbF7eGMiR78JQn5FQfXRYTXYd/GS1EFf24JE8wpF8wV4tJx7ZauLSaailJjkzETXR6BNdHpS6GQXQju9s6jQA5dng2ZYTz0yoiDJspFGVOdbGqWwIDCZoaxLkrOqQhAksTX4RYrgERirp3QisXnpjmcjBN9v4Lu4D4V+2g1NOCXLZme7I4M2qpD5zJZpw== 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)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:VI1PR0801MB2032;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2032; X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(346002)(366004)(396003)(376002)(136003)(39850400004)(199004)(189003)(106356001)(105586002)(217873002)(956004)(61506002)(14444005)(66066001)(486006)(478600001)(11346002)(446003)(7416002)(39060400002)(7406005)(26005)(186003)(6666003)(86362001)(575784001)(97736004)(230700001)(476003)(5660300001)(16526019)(6116002)(3846002)(53936002)(103116003)(6506007)(68736007)(386003)(305945005)(7696005)(7736002)(76176011)(81156014)(8676002)(81166006)(2486003)(23676004)(9686003)(25786009)(55016002)(47776003)(8936002)(50466002)(316002)(33896004)(58126008)(2906002)(52116002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2032;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?q?1=3BVI1PR0801MB2032=3B23=3AC+F6w?= =?utf-8?q?cqNwjT04he5iZERmtP+13A7muZVzNyhH3VhbxkO1BfjSeCjEr5IwOSJjGGcgntwiA?= =?utf-8?q?pLgqV8TgjNfgKCAAiYaWY1kh2xnb26NrQGiZYHXWsSIWdcTQqZNgfg4TuEgOoqNk5?= =?utf-8?q?+3estAclrovAl1dN0UAxySiVd0pNumssXq16dXDJ8OZJn0anN/EfWwevoAKPobkA4?= =?utf-8?q?HfYip3BgBFC1euQYexLgkoYvIBg0ibuh/dVzFHzkqj8eSorHZI2lPPGJKF4uH1M7G?= =?utf-8?q?3H7UaR/cdLyZRT5SihXf3Ykaksa83eqJ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dkZ3Op8IjW74IHO2d50UhHuqXPGZ4uVwJyQVBJ93IAgLDh0pvfTfpo0EuSf8rdnqzbEjYMhAxjcsJNjS4IM25eZx4egctcLqSLctmRXiyppkHBXdX9H48UJRphAakfHbmVzG3bihCyex+DGhoDvelJeTdqocmZqJSKn90=;7:jmnjxCVhobgFRlAE20T8RgDhCUaDMUMlT8FPI1qmHe7k88XW5AIvRS3aW2s4Rofb3pARVjK26KNUgsB5X5DRqGEA9UEKfTgKilPmUDHESJL1eeRJXpax66izN0zNt6R1yVnu7bA7hCYMCRWHJf6iSmSeuQlvJJXDRF/dvbpQJDOFpVMQTN4P94OB+cHyGEMJHbVy6M08y7hoa+lRnSrId+A2NkMUXD4DmMcYOjkTvOlLtAZfviWIBBGiuxfZ/QuD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;20:umyMl2BNKxz61NYa8ZIs42Emw4BgclTsfxCVNiA/Xh6iaKmJyU6INIkWaf5IHOVd7xF5cjdVv5e//vR7twU8oS7wKKK1EJQlmWUp1dHQovH6eMmwdqBUjYpcNBvnXB12E+tjTN4hazLwxG/rm1SxTmwvW6wIH5pyTWfXep2iOu0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 15:39:30.9644 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a61e6cb-96d1-4380-78ae-08d5fc7bfba6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2032 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Previous patches made all the data, which is touched from super_cache_count(), destroyed from destroy_super_work(): s_dentry_lru, s_inode_lru and super_block::s_fs_info. super_cache_scan() can't be called after SB_ACTIVE is cleared in generic_shutdown_super(). So, it safe to move heavy unregister_shrinker_delayed_finalize() part to delayed work, i.e. it's safe for parallel do_shrink_slab() to be executed between unregister_shrinker_delayed_initiate() and destroy_super_work()->unregister_shrinker_delayed_finalize(). This makes the heavy synchronize_srcu() to do not affect on user-visible unregistration speed (since now it's executed from workqueue). All further time-critical for unregistration places may be written in the same conception. Signed-off-by: Kirill Tkhai --- fs/super.c | 4 +++- include/linux/fs.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/super.c b/fs/super.c index c60f092538c7..33e829741ec0 100644 --- a/fs/super.c +++ b/fs/super.c @@ -165,6 +165,8 @@ static void destroy_super_work(struct work_struct *work) destroy_work); int i; + unregister_shrinker_delayed_finalize(&s->s_shrink); + WARN_ON(list_lru_count(&s->s_dentry_lru)); WARN_ON(list_lru_count(&s->s_inode_lru)); list_lru_destroy(&s->s_dentry_lru); @@ -334,7 +336,7 @@ void deactivate_locked_super(struct super_block *s) struct file_system_type *fs = s->s_type; if (atomic_dec_and_test(&s->s_active)) { cleancache_invalidate_fs(s); - unregister_shrinker(&s->s_shrink); + unregister_shrinker_delayed_initiate(&s->s_shrink); fs->kill_sb(s); put_filesystem(fs); diff --git a/include/linux/fs.h b/include/linux/fs.h index 33dfaed0a01a..8a1cd3097eef 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1902,6 +1902,11 @@ struct super_operations { struct dquot **(*get_dquots)(struct inode *); #endif int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t); + /* + * Shrinker may call these two function on destructing super_block + * till unregister_shrinker_delayed_finalize() has completed + * in destroy_super_work(), and they must care about that. + */ long (*nr_cached_objects)(struct super_block *, struct shrink_control *); long (*free_cached_objects)(struct super_block *,