Message ID | 20230724094354.90817-14-zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23468C04FE1 for <linux-mm@archiver.kernel.org>; Mon, 24 Jul 2023 09:47:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB83A280001; Mon, 24 Jul 2023 05:47:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B429D6B0078; Mon, 24 Jul 2023 05:47:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BCC5280001; Mon, 24 Jul 2023 05:47:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 895AF6B0075 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 05:47:45 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5FDEB1208D7 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:47:45 +0000 (UTC) X-FDA: 81046028490.26.166F0B7 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf20.hostedemail.com (Postfix) with ESMTP id 8C50D1C0028 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:47:43 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=gX8Q7SXH; spf=pass (imf20.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690192063; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rzRsL3uPXf8EtZhij3twpf+iuH9MzH4dVPBmPqsS5Og=; b=t54+RbTqfWH6H0YfdptLH7L2wHRSw44lIvxNdHMmWCs06Y3EVis1ZXWvNWSCY8PT1dQfeP OIheUxWLlRCRNqDI46IDFbkLFw/TpGA0QBsR/aReCQZIMiLPJ8uRtABsGcQ58YbA3Aakk/ WQh0K5TF0h3CIGnUNbJPDjVQkY7hC9U= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690192063; a=rsa-sha256; cv=none; b=0NY3gV7hhMk2TCsrRtdtrx6ewZ5lPkMqLZrPNpMXlGIAMqjRZT35SvVyQgLJsYMZBVm7s8 dZ4/2/jhkx0m0lt1/PeFwyF1r1hBUG7JrbBH0xy/xvYAIJfVXppJRS9+ERnXofj4oDOiZS 6n2VqmEwLn218TsMDp78wTyJqd6rh7o= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=gX8Q7SXH; spf=pass (imf20.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.169 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1b867f9198dso8896315ad.0 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 02:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690192062; x=1690796862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rzRsL3uPXf8EtZhij3twpf+iuH9MzH4dVPBmPqsS5Og=; b=gX8Q7SXHLW91QeJQyKDVumBjdRBjyll1XQW/JTChdq9dJqktv+X9ib4/uAMXxgigqH 2jaNwNGzNzbxV0P1Wq3smVBCy4sNVeMp2d3znSQmH+08EqCorhh8sobS3FzAo1aci+WZ ahKKXhVh1u/zcYQLSV07bWs7cg92+ga+7wTGv6JJSEqo99xKqc3+YUXi9LMwyQq6STAk AcT7MY/9kuaNFBZqw4pd3+jIBecT2Ao+Yw0ycAdTL8xM/HvxupDlq0E7GLdDU4836YR8 3HkgcSbyA4vS6vLviPYG979wLCQ5W42uSMh1vXnsGUiqQWrA1KKfF7bNogJb+rMbZ6Yg D/lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690192062; x=1690796862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rzRsL3uPXf8EtZhij3twpf+iuH9MzH4dVPBmPqsS5Og=; b=TbKxD9U+2DQQpNTAL0zPWGdF8/DMpyuLMof33lyJQyws9nKIndCd4Yn3/3/qHKkYTf 8y7lLyy8eAI0Wzazfej0KV0uDi5fluaVd+TD6Jj08H/HbO5mxtSCGwPgqVPylXXlMPof 0RkVW5vuGEDs/K+jY/71aN9wha6RrDWfj20xYwATbnuNXcLrkIWkWO2zKgKxNBsKx7gw 9nHqf2C+L9aRciruEo+s4QBwvy+rjZ+ssi5VIxLa+9/RinCVYEYx1JPIMsyoJ5wmZ9tj G+Rh+tf8zgPyx9XA2unZRLRleuF3Kvq+OeJO+m1detqCZ8Xa/LB5cgIY4kLNpBVYaJzh LIvw== X-Gm-Message-State: ABy/qLZLQaaNbwqil5/XF3G+hsekQ3tyhZT8jaNsZpzoNwAnVVZpsx9y p2dnHDdKEQiV7FBUFHjjg3ewaA== X-Google-Smtp-Source: APBJJlE2hlcoboYUdUaSOoRiDnmiId7r6Wv5DYfSEbrHd1JPgB9nwdB4ObCAMGW7eL9gTiY+r7GrFA== X-Received: by 2002:a17:902:d508:b0:1a6:6bdb:b548 with SMTP id b8-20020a170902d50800b001a66bdbb548mr12141350plg.1.1690192062448; Mon, 24 Jul 2023 02:47:42 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id d5-20020a170902c18500b001bb20380bf2sm8467233pld.13.2023.07.24.02.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 02:47:42 -0700 (PDT) From: Qi Zheng <zhengqi.arch@bytedance.com> To: akpm@linux-foundation.org, david@fromorbit.com, tkhai@ya.ru, vbabka@suse.cz, roman.gushchin@linux.dev, djwong@kernel.org, brauner@kernel.org, paulmck@kernel.org, tytso@mit.edu, steven.price@arm.com, cel@kernel.org, senozhatsky@chromium.org, yujie.liu@intel.com, gregkh@linuxfoundation.org, muchun.song@linux.dev Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org, linux-erofs@lists.ozlabs.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nfs@vger.kernel.org, linux-mtd@lists.infradead.org, rcu@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com> Subject: [PATCH v2 13/47] nfs: dynamically allocate the nfs-acl shrinker Date: Mon, 24 Jul 2023 17:43:20 +0800 Message-Id: <20230724094354.90817-14-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230724094354.90817-1-zhengqi.arch@bytedance.com> References: <20230724094354.90817-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8C50D1C0028 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: abzw8bqxh7kux6kqqpaeph5p8mtxix16 X-HE-Tag: 1690192063-329833 X-HE-Meta: U2FsdGVkX19+ADm95WmuTBbN/Wjm1Wsh6+3MBlzONil9VQxWoLJwjb4Fk3lu+V+nXFu1cG04YBKX8LRqo1vSANoVAm/g9sq7LaVXEfwQ2czcRwESiVqqgezRnKhNWchrbrsF0Za5VUNMW7Fvg50Kz+E9WMgVEWPkfYOQHU7vyMvY58HygAbXqVl5geIAIhT4pExfnqmz7Pf73cgGz9cDt1N0Uji/vbeUgmn4VDf0jjmHXRNEB3UWBh21b+R2qVGr2+azbmKJEtwKDnMDM4R2RehGaLoCjNrPBKvhCj2m0cg9FxvGO0kIDNDCBNRvLvWxTQEZGqRvDKN/kvFTqaeUm8saHcqtw8RtqnmFSPCkmqYJpp6VlUJ/h1oA8oVc5NzyzZ8v6SQ+bvbt1EXa9bgTfusOn1/N97+JnnGsN8nXZn+4/fNZJTUgBl97PDN7xV2wxMuVh4T0VaClKSySCG1R0KuWfLGQtvdQNwYNkOyrH+VUGwnOoNMpn8rs4ViyZhCrqm8AyQSgbN1ty2rZwR+pQHdVLX6FqecQZWrLhVaLSZrisQFcOfP8eGSW5UkELUeI7dxRPsxcNXkAIOkX+U//T0RLWt9twM+WhJDEPW6o9uIxUs2roTd8pBSLUYdCd6MTxsi52eUVgE1LQfkjxNwFbBe5jJkiJITXxnBWEkGTK34FgfMDBQjB7DVcWd/t1pxxcPapA/Y1+abQg9PWcHRgiNeaXmFP2j+mGNRdmgB4qHVFiA1iXlkhktteZqBfjgq+8xaYASETIuiDNVswfTzTcrbwgazZlvpOg+4wsfAl/K6PuA6NORNwnTMyq3F+fk+EQ/ktyL1hqEZTt2VXsAMyRM5kDv+GqSGtJnxA3SHtyRRXN9GgKxUBa0EIrTlSGPj2W1N62YEcCOHciMeKNnVNkBEiVzmA/HUSnP42Tji2IitWn8uHR3YpcExVX6cB9Ek6KrmObduY2xoRnN3ksW0 ghoJTwbP 5TER/I6Gt2m0uAglL7fABc6YOAHD0AMT8bdN5JP8Y0H/plWRHnHgzZhYrLmPBK51Hw4d2c+ZzpkpHfvqJq3x9Qz7kRXSWjJSnHHJFohzNLPH2ppS2NRZJkkjvR3KBDYpVcEtXryx2ZzLbHnNBFj++7WMbTLfuVvSz8LaFjUQGMKv6hdH/phNuqk+r+Hmvd8Rq3scvfQw2HcQLahNYfMtlOvzdifl2sdp95tgu4Y4DIYQtPbr7MpdeX7FKTt+si5MgfSXYDL/ikekrqM8/qe0qS7GjTazrEVsHimS8Io/c/Z4/xS8kw49qa5kVTUc1EkYxSeGTmq0B7+Vn5VqLCP4YmZs9IsQC6+WWWJ8wXYOIu6h9U2XJWVqthi8kgnU1VTzxuhrvrJxdz+/Vq/DnqZHJBou0EZjShZg1nLI3 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
use refcount+RCU method to implement lockless slab shrink
|
expand
|
> On Jul 24, 2023, at 17:43, Qi Zheng <zhengqi.arch@bytedance.com> wrote: > > Use new APIs to dynamically allocate the nfs-acl shrinker. > > Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 2284f749d892..a90b12593383 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -129,11 +129,7 @@ static void nfs_ssc_unregister_ops(void) } #endif /* CONFIG_NFS_V4_2 */ -static struct shrinker acl_shrinker = { - .count_objects = nfs_access_cache_count, - .scan_objects = nfs_access_cache_scan, - .seeks = DEFAULT_SEEKS, -}; +static struct shrinker *acl_shrinker; /* * Register the NFS filesystems @@ -153,9 +149,17 @@ int __init register_nfs_fs(void) ret = nfs_register_sysctl(); if (ret < 0) goto error_2; - ret = register_shrinker(&acl_shrinker, "nfs-acl"); - if (ret < 0) + + acl_shrinker = shrinker_alloc(0, "nfs-acl"); + if (!acl_shrinker) goto error_3; + + acl_shrinker->count_objects = nfs_access_cache_count; + acl_shrinker->scan_objects = nfs_access_cache_scan; + acl_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(acl_shrinker); + #ifdef CONFIG_NFS_V4_2 nfs_ssc_register_ops(); #endif @@ -175,7 +179,7 @@ int __init register_nfs_fs(void) */ void __exit unregister_nfs_fs(void) { - unregister_shrinker(&acl_shrinker); + shrinker_unregister(acl_shrinker); nfs_unregister_sysctl(); unregister_nfs4_fs(); #ifdef CONFIG_NFS_V4_2
Use new APIs to dynamically allocate the nfs-acl shrinker. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- fs/nfs/super.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)