Message ID | 20230807110936.21819-15-zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-raid-owner@vger.kernel.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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07EDAC04A6A for <linux-raid@archiver.kernel.org>; Mon, 7 Aug 2023 11:27:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232719AbjHGL1h (ORCPT <rfc822;linux-raid@archiver.kernel.org>); Mon, 7 Aug 2023 07:27:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232578AbjHGL1U (ORCPT <rfc822;linux-raid@vger.kernel.org>); Mon, 7 Aug 2023 07:27:20 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59633A8E for <linux-raid@vger.kernel.org>; Mon, 7 Aug 2023 04:24:01 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3a7065d0f32so481267b6e.1 for <linux-raid@vger.kernel.org>; Mon, 07 Aug 2023 04:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691407393; x=1692012193; 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=bXWVUarOzaru19EzNNU6kGORaLUfzTendve24oswf8diZdN+Brvjd6PPu5YxAtRcbO Hh7iaNiNXdBQc9KXYGfYOt+uGVlhqPQwcnYIFI2nmVVyQewA3mF56OQbqc+npjh54ZoA tpA3QTg1LZj9ldBJjxZyti7xSNQIhD2OfUu3jFVxOr0mMdG45JS89iupa9cnTgwZKg9I cBNY936juUdKQ+zaR6g8XE5571PBRhCbyRFAbYuk8uAOTFFEg6sKq9+kJxHYEMlkaKVP l9h3Mg62aCAYsPDTcs9A/zC86q08NpXnvXx24DRHkq0rchFjQSQ94XyetBFC77HeIqLl I/zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691407393; x=1692012193; 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=ioRodUBMZ2MkzrZN18prIGzDZKZi6wto9Tx/mEZpk9mLNFo01l/sOppk38rXwFpr55 bQ7V/9/p1rVd9iBneO2+/wEtpTEdT+aQpK+36keDYmkbAlgGvhujx96eFrsLnKfG/b4u +U1SyaZ7MZAsvo8H3xtn+SSRLmkdUhjWQ/zvxniNg5AQF9GQtwMeJjoRS++6vOKlu0/J 7hUxWLDJ187tTv4BzLsUTaA7/KSbxavBTCqCQLd6+GgGRHqbI8vIYQIBwJn8Gsjo9L7D ipkro8Rk3I+5w6Os21VGcZMcl/LCRpfmnL5shYsaNTDQfVHMqbJPYwFcd8br4P4mLr99 U48g== X-Gm-Message-State: AOJu0YzgHWKupQxGje1+9GznSIP+pDpYMXpyo1Q8bwxZS376nShQ9QRh gxrhj+mssAXiy8mG9fPCKidDvAM/r+whwuXX0uU= 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 Precedence: bulk List-ID: <linux-raid.vger.kernel.org> X-Mailing-List: linux-raid@vger.kernel.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