Message ID | 20230911094444.68966-12-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 AA06AEE57DF for <linux-mm@archiver.kernel.org>; Mon, 11 Sep 2023 09:46:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 344AF6B01AE; Mon, 11 Sep 2023 05:46:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F4C36B01B1; Mon, 11 Sep 2023 05:46:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BCD46B01B3; Mon, 11 Sep 2023 05:46:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 0ADA76B01AE for <linux-mm@kvack.org>; Mon, 11 Sep 2023 05:46:50 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E43121CA3EC for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:46:49 +0000 (UTC) X-FDA: 81223837338.19.5031861 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf02.hostedemail.com (Postfix) with ESMTP id 2ECC280003 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:46:47 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=DrQplDef; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694425608; 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=XGYwucYG7HTVpzK5CooX1KDKxtCfW/GyjCRxwUVGc8U=; b=sj6spv1xGqIER3NhmSGacX9jfMb4bI+pFzB1EHS3R6NPiCAYFrdZOiXk4TKeMDBCvhvvkj vR805lqHz1COa2i/Om/r5BWDgZ5kz/yt5kmp8kTJJeEPofQntFlZqRG+Zwhqtn1wbF5yFT R7P9Fm0F5pHiq5Izks/gXgnVGN+0cr0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=DrQplDef; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf02.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694425608; a=rsa-sha256; cv=none; b=CGzwqbXHO/Bzhv25zE87vW1+RUEzZfWdbp+orOxlfRxZIr9y5OXdqVb0OVTFAKgvapX/zu kiLrQ8hzsLVI7S9li62kSUQy7H2J7Tj35yS4u5in2vgOA0ZYv7GsRxDU8kfF2Yrr3GAT8Q LbatcT/MqegmThZZpxMKuQajKoXDEGM= Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5657ca46a56so444949a12.0 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 02:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1694425607; x=1695030407; darn=kvack.org; 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=XGYwucYG7HTVpzK5CooX1KDKxtCfW/GyjCRxwUVGc8U=; b=DrQplDefwdg84Y/aa7RbWuRJKeHtoGiGMTmYxjuAEDhWZOxmnKg1KBynwlON7GHpCN mHrajSeoBrwONoUU9/V8ycTMVJ9+0TCrB28B2xgAUKiidrK//jLGsWS1dIMoaY/vdeiC XPli9/PB2uxDeMCe6IxFBPxOUmsqmMRcDmFhP+GgcMalkVysgEDzUhRqL7lZxGgzHcLH yQ4GFQI/IlsPXTrUTkjViqRjAyJeehQQfy2oZJ3888hpr4Wnicspw3sPUJSnVn1QyihL GrNc17XbxCqjInCwThnsWfKtAoxM//gsvRgn58tSrW3+VSEMxu2jLrD2eHXSwyp9kF3o jCPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694425607; x=1695030407; 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=XGYwucYG7HTVpzK5CooX1KDKxtCfW/GyjCRxwUVGc8U=; b=u+oiDl1V67UsEeiHw1ACCF/YCSTVLDCEeLzljACQC3QIGTINBqC1OU+m5Bv7UhJpsZ fqeMChtn03A0SfgaQC+5oIKSDmHKRc8xV7xPaH9nGUw5/GaBt4w2KUbvXYyT0TxqfhPG xxKVpRLTz/rE7jzuKDwEOkOKhsAb90UkBfEEYhD1MvAKBq99xcrB361BBamH+EdCFftu 1M5Gm2lRm1ASu65WgHZlbt515kYBCGD+iA0tPRSmZHRukaBpJjTA9ubgDlp1g5sRJL0h FF3s9YxukyTeNv4E1p+LjZ+jxvwwWFxaI0dnffcFDXpVWePWfUC+RKjf//l2ZZN3lhRJ EDLQ== X-Gm-Message-State: AOJu0YzJ70ZVzktQc2HfEVrCBTbYl4kcsLAcQGCliZ0cHzioTB8FjNRQ WH52nAkyy6EXm1fcFL3cm3P2WQ== X-Google-Smtp-Source: AGHT+IEATGFeLgyETjwn0MpUPq3DvWwKAg9V030xDC3jjIEkUp9pVkRI070K/5NVvqZMyXiud/buJg== X-Received: by 2002:a05:6a20:5483:b0:140:cb66:73aa with SMTP id i3-20020a056a20548300b00140cb6673aamr12967762pzk.3.1694425607113; Mon, 11 Sep 2023 02:46:47 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id az7-20020a170902a58700b001bdc2fdcf7esm5988188plb.129.2023.09.11.02.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 02:46:46 -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, linux-fsdevel@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com>, Muchun Song <songmuchun@bytedance.com>, Trond Myklebust <trond.myklebust@hammerspace.com>, Anna Schumaker <anna@kernel.org>, linux-nfs@vger.kernel.org Subject: [PATCH v6 11/45] nfs: dynamically allocate the nfs-acl shrinker Date: Mon, 11 Sep 2023 17:44:10 +0800 Message-Id: <20230911094444.68966-12-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230911094444.68966-1-zhengqi.arch@bytedance.com> References: <20230911094444.68966-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Stat-Signature: t5by5dtpy7h1314h48y93b5u4ni5f7xp X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2ECC280003 X-HE-Tag: 1694425607-109806 X-HE-Meta: U2FsdGVkX1+dOYxmVsp0hKtKulKEGVYjBlBkttG5frcIl0kGaUFozsR1w3GBD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ukUAJsHpNbK/BrSK2jHRfWFhTeQV9ZG3E4lDQxbonDka13sXVtIeKzOobiaLhELTog/ji4oNVqjj5i5X8pB5X4V8CiSR5puomn/mXDQOMH4QbCuNczNGVvbnlHLwTDsuDIfXL7XAFOgIpsWctsX0+i6frgu64WeStUsJP/JQ55cSEx8y7gKyWYZMvn/FODLOZO2nDLDJ78r+aoZ6nfEu8c7OOO4pO6cp23ijsDf2hpMZKUcScvQJGnYYlwfjLtxzvN628FRHLG1H4+pVIjooCYSY7rTMOH5StoOnxOC6ox+hNkPH1qJxsnzhbH/lbjlwPR3IB4Q1/6Aa34ecKTnADM3F+HDiywMTagLRq9TXdqeoqKXZv1hnpyudZlppUBDZjI9/c7mSYw== 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
|
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 0d6473cb00cb..09ded7f63acf 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,18 @@ 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) { + ret = -ENOMEM; goto error_3; + } + + acl_shrinker->count_objects = nfs_access_cache_count; + acl_shrinker->scan_objects = nfs_access_cache_scan; + + shrinker_register(acl_shrinker); + #ifdef CONFIG_NFS_V4_2 nfs_ssc_register_ops(); #endif @@ -175,7 +180,7 @@ int __init register_nfs_fs(void) */ void __exit unregister_nfs_fs(void) { - unregister_shrinker(&acl_shrinker); + shrinker_free(acl_shrinker); nfs_unregister_sysctl(); unregister_nfs4_fs(); #ifdef CONFIG_NFS_V4_2