Message ID | 20230807110936.21819-15-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 6A9EDEB64DD for <linux-mm@archiver.kernel.org>; Mon, 7 Aug 2023 11:13:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0AD5E6B0075; Mon, 7 Aug 2023 07:13:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 083BD6B0078; Mon, 7 Aug 2023 07:13:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8DA88D0002; Mon, 7 Aug 2023 07:13:01 -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 D75946B0075 for <linux-mm@kvack.org>; Mon, 7 Aug 2023 07:13:01 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AB9BFA05BC for <linux-mm@kvack.org>; Mon, 7 Aug 2023 11:13:01 +0000 (UTC) X-FDA: 81097046562.15.05C8B0A Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf12.hostedemail.com (Postfix) with ESMTP id B59FE40005 for <linux-mm@kvack.org>; Mon, 7 Aug 2023 11:12:59 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=g3KOL41m; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf12.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.178 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=1691406779; 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=iXZOOFmuwv6/pQ9jzhgVENlSQpZ5agnqrhquB4Bsoao=; b=OKW5MyqGc3aeAhmJO6XfCgN+2CeWptm2DXzJooNIxlbFrNLX8de8Jdil7I86dNLBaVB15x +MzHnPFFd05ESrg9DNV5dZuasEKp9GHZD7jNcUSwtJnOYIQJFqVEdwu6wlZu0vPwrgRze3 PkxqZO1f4XbNra/494S8ya6imllGUOg= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=g3KOL41m; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf12.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691406779; a=rsa-sha256; cv=none; b=QqYlE5WAeJ/0kDqxeY7Zwp1TVZA6maK/oxGh2YzBuAk/UixUWMErcdn/tB3ncWY72A5Dmq N3e7lWMioIWs/GTRi9enMBhk8laldyZLLwLuVnVvpfRgDXtycdUOhcDE+W0+AsEf3hUIjm kIgNK/Lib9JmS0HK4Q7rQHsFIK8dMB4= Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1bc76cdf0cbso594075ad.1 for <linux-mm@kvack.org>; Mon, 07 Aug 2023 04:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691406778; x=1692011578; 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=iXZOOFmuwv6/pQ9jzhgVENlSQpZ5agnqrhquB4Bsoao=; b=g3KOL41mxVnCoIlh87RyEsDJeaXpKCIwoVRjVxhTYPV9ovyT4HRH6y73TA0C1Q2AYh C+3L3G8pIHBsXVWnvOx0AYLweEtefCIlRKKK8q0sPYgt+7jxn0bL+VsW/sqLMELcQU4/ RSW5M4MR9/5lWavNFyTrMZwhNOCIGcyf5LN7etoWY5j2p6K+9KrJUCEBYyshFVPRQ9qE 9NhNeOSkMhfop8u2oBI3A6CKgZEogh2PPWGLFqTsvR6J0EWD/e9GH+/ajfKoDwPmRCfa I4bJZTgzaT9SOC+CveLtEvd/OempVrgFf6BTSlV6Y7dsnz5tzmtW7m2tX5rTM+xAbpCn YMzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691406778; x=1692011578; 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=iXZOOFmuwv6/pQ9jzhgVENlSQpZ5agnqrhquB4Bsoao=; b=OZPgAPgHvb0tM5R5CqDHLMy4ugttE2y1V5msHGGR9rzgAsV8SNAsuZGiKDESfCcKgd poMxFP85XLI1xizdllarQbSv7K5P4z+lPNHnilaDbiVXZi3ewaLfk+mOCcLtV3597Rky YyqEn7kMKcqjScUv04J33jdUUeZkxnZry+KUZffwIXrFqcPC7rXM6ZPVoWG2pF7MNNeq fHlfVZ3StUfASbuEOswuD+PDmWWMKVkYHpzetMc/Zw/P4T4qSssQzaqwp7kkKy+9ZTOT HKCdLTzN2AcJT95aE1xEP64dpvCKWXzNyu0bkzSBBS9w9Rp57RDMI9GQ6xdYJGEUlV9D dXpw== X-Gm-Message-State: ABy/qLagKiJZ/gs4R9egg0jpjuKJgfr4OyAdXkArkL0aLY03ENIzYENQ JMELxRGbR4iwZQth0LmhPzaqQg== X-Google-Smtp-Source: APBJJlFDSvCAq9gTdHkFF7Bzn2YL0W/qaEPzJ7AdGJ/zjCXgG1JFMDLiaFr2l43qqes0mOglkhZu9g== X-Received: by 2002:a17:902:f688:b0:1bb:d7d4:e2b with SMTP id l8-20020a170902f68800b001bbd7d40e2bmr33138766plg.0.1691406778592; Mon, 07 Aug 2023 04:12:58 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id y13-20020a17090aca8d00b0025be7b69d73sm5861191pjt.12.2023.08.07.04.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 04:12:58 -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, simon.horman@corigine.com, dlemoal@kernel.org 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>, Muchun Song <songmuchun@bytedance.com> Subject: [PATCH v4 14/48] nfs: dynamically allocate the nfs-acl shrinker Date: Mon, 7 Aug 2023 19:09:02 +0800 Message-Id: <20230807110936.21819-15-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230807110936.21819-1-zhengqi.arch@bytedance.com> References: <20230807110936.21819-1-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B59FE40005 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: pu5obong9yxychc9yhgmgiwt3dpf3u7z X-HE-Tag: 1691406779-869170 X-HE-Meta: U2FsdGVkX19mx9OTReCAJSm8OPj1m54IilkMu3xZO2aj1Wh7l7ns+lRmWnNh/8hOuuWD7EIjoRn38bKaZxL4cMrlN9i09o/vW+I+sDf++ANnQgDtOneEJ/V8/btVeE/igtDxTRGuVluU1VPFLM72y88dOWdV1Xnc5an2GlFRLq5jai3bu/ZdoRB+crhHW/3TP5Be5x/8rygfqXlnBDMciMI1iLIsJQo02VV3AYNVCZKsxUdzIfnbLpBQH316MOuePJpr5+Cc0x978fntwLe6xHXE+F9ZR4BJDptJwK/BKziGEb5YZA7Xas8ny2WuCzmoqjGf0bIEHeJO/+wg+ZIL/lP3ldXS5WYaevrqUMnBb2kn7lOIbxWlY5bDF/2S1zlMoIdRYirI2hTgchj++CaDp85xcbrDkI3gXDnB9T4e8oIELwkZ7LZCbEMgM89Qfny149lAdg7Gt39krtlrG0jKgmpvWDuAIb2cvtIOc/+/syEKhyZLemMWYWQYH9fCuGsQ/zoKk3H5EgKc9TwLaT7x3qUY71v6WPgGwOK3bbHU/sRCu4vtR4f+OvwawjzbnBVaEncknGULc16WTbcF/6sLZ3D3bAoiDrmb9wMODwHTPNOspvQ4aZm10GTq5Mywiu/6XE+0rX6Pj5fOrJehucsTmaeIfYV/HsxYNEKLRMZGf3w6B87E4ghij58DjEX+BcaiRm99+tAfZUGLA6v9BC96Ur+XX0Ul+ga0ulhn+/JCA+dBejwPqPKfCT7ZebsE/WoSzFKMB9q0MbZ1nl51AlOfr+wgA4TE5keFq1Dv1itX1w+r9JOulWKJmAX3pZTAxN1Z6eTqR13vGZpAp4Q0MaYLHTdFs4ygBmKm/hVqBlju1ZDJrdnQ3yf8udqkfbro0vRofhKrPnhKsohxEJ7S/y4BPLCv/Axf6sj8EL7OsQ721GfZIm9hxMKKDC+4bxUSp7ZHp2ZWn8s8YUjVfM56zEq ki3L2KYX UuWfD41OqRxSEWaXwwYplBYw+8EVXZti+pWxTpLhC/TYaCT+CmlsqFLeBh0ALD3tAybXgaG3w30kJGkijqxIt5bfBtVti09DU9erEkbuuOXX5xjVrQGPPxStuzGMXvqtyfJBUTRCWDH/uLciruX5k0DcdvKCx7JcPrC1cH0eCECyTYDHwIseLzdi38dliv1nGXQyAW94f6vL7mCNqzIick6jlOdXbAJnmzAmy0aj4eUtA/3BBvQBD2sMvolUOZtH+e3nmyPldEM+Om6/0dXYMkf1tnoh60Hx53cgeFubBUpTUSLc7avlYhKBKDnPUwOstahjupqdGyM1ZFhHffF960g67ZrTRUZFYMgWl/H+xgDwio3fqkyIEG0ABHO0Hdh6GsNiLs1YOrFP1nM55dMWAAFSo0N9avFBBt/HP 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 2284f749d892..1b5cd0444dda 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,19 @@ 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; + acl_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(acl_shrinker); + #ifdef CONFIG_NFS_V4_2 nfs_ssc_register_ops(); #endif @@ -175,7 +181,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