Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4871715imm; Tue, 7 Aug 2018 08:42:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcQgeplBltX7Sds/+y2xTCoDD5Dpi/DCm3Cf/PFH5j42r4cwFiE4TLXTed0BZFJavESG6og X-Received: by 2002:a17:902:5a08:: with SMTP id q8-v6mr18066550pli.300.1533656548036; Tue, 07 Aug 2018 08:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533656548; cv=none; d=google.com; s=arc-20160816; b=sFDQV9PCKY8w5HgoEOZL0Hjj/4tkfLYk7eijvXd442oIS8aa4i0BE7tu7QozL0pSYi CI2EF9qVWaQQCAUGaYUMLrF9eRNTQSJE0SZYc6kpyWJ/M5+xXIudJEsUPZNENsRHxj7k rDkAfLKWUBVtduh+Q/HeieeTB56XJrZGGVKIg2lOfhsYWf63d03YUXgtGWbXavuNokiN LHN3HKo1loj7FX5XHnUd5502S96wYV4GtTpC5irOwlFJ3c41S9dt04AXyXSVmlYtM5fg dxDtVRfBM2rJa3Wo/WKlJj8PwxVq/nF/YU7FMC6z/IjmVhgd5dO60dQ/Q7AieV8GmKss 4JoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject :dkim-signature:arc-authentication-results; bh=NpY6Q6iqU9qbYbRcjvh1dP1lXspTE+mMdqm0dAmnulA=; b=LHEDKWiIO2LPVVYhizgrQ2TKTTBS4mRiDwNNyLJp6DlK8dFP8ASHpmt7SQ6h90+mXy IXFr+59egcyl1Gx5k4iZr2UG2B/IokRcICiQtHkwJeXmv3VdJmD1AHOr7Aui4qFMGFo4 93p07An32R3O1v7HPgsshSBCHRJmd7nZOZ5lnTkr3OSkNbVjI3uHIQRZRasQ8Uvedxup AM8r1AUQr4UF93QtpvgV171igv2BXirJ/YW/0gwCgzxGgZJg5yfi8wQ/Ha6yLZQ2Gtrk MmI8QQgeluGhTA2J1Wb0XyKCrkASkUvL+W/WPmqtyXfPGN7iOZckpPBLUbq8cPgKHuZb 005A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=bh3tIYe7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21-v6si1509191pgk.337.2018.08.07.08.42.13; Tue, 07 Aug 2018 08:42:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=bh3tIYe7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403901AbeHGRyg (ORCPT + 99 others); Tue, 7 Aug 2018 13:54:36 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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?B?MTtWSTFQUjA4MDFNQjIwMzI7MjM6QytGNndjcU53alQwNGhlNWlaRVJtdFAr?= =?utf-8?B?MTNBN211WlZ6TnloSDNWaGJ4a08xQmZqU2VDakVyNUl3T1NKakdHY2dudHdp?= =?utf-8?B?QXBMZ3FWOFRnak5mZ0tDQUFpWWFXWTFraDJ4bmIyNk5yUUdpWllIWFdzU0lX?= =?utf-8?B?ZGNUUXFaTmdmZzRUdUVnT29xTms1KzNlc3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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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 *,