Message ID | 20230911094444.68966-19-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 3E206EE57DF for <linux-mm@archiver.kernel.org>; Mon, 11 Sep 2023 09:47:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D0C096B01FB; Mon, 11 Sep 2023 05:47:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CE1896B01FC; Mon, 11 Sep 2023 05:47:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BAA016B01FE; Mon, 11 Sep 2023 05:47:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AA7B06B01FB for <linux-mm@kvack.org>; Mon, 11 Sep 2023 05:47:53 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8A1591CA3CC for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:47:53 +0000 (UTC) X-FDA: 81223840026.05.A94786B Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf20.hostedemail.com (Postfix) with ESMTP id A5D6E1C0030 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 09:47:51 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Vq30w72H; spf=pass (imf20.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.177 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=1694425671; 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=4+dyOdEpvdrL2eUxAXXyGxIB/NcoZnEV+TKBfmBMmgQ=; b=XeLUjVX5tz3VFO/oloXcQ4wTiAwt51bpU9hg6Y0wky1I3HnpOBxPyZtqV+8zMTXNCpCl5F 8+H5gQG88m6myr0fR56esI8wxiES1pC1/GcnnccXXrlby0JiYiuxGMjr+hjHRXQad9dQZi NJlIFqmjWNufpJ4l0XQ6dzKgUqWestk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694425671; a=rsa-sha256; cv=none; b=H+2bcEcgS9ZiHBm0zpcDM9cmJ2jdvqUlcLR0XBkkp5U5LZl+T7yzpsHOxxlVLMPyDIaSNu 7kKHUXN9uAPOrmk9YfPLiU4W+kyKacVvHEHb+5O3cSpPXRofZLlPDayG2ZT2IWeHSNCtXs fTa1aAwdunKmDIjAlzi1aB0gOGLYW94= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Vq30w72H; spf=pass (imf20.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1c0efe0c4acso7087595ad.0 for <linux-mm@kvack.org>; Mon, 11 Sep 2023 02:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1694425670; x=1695030470; 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=4+dyOdEpvdrL2eUxAXXyGxIB/NcoZnEV+TKBfmBMmgQ=; b=Vq30w72HKf9qiMUVMQ5KkTwn1pyfxXQYKWvT1OvyHIXu11zJc7ZFkuD2CT0r0K0sva OvuVWkJJhsKDJNC1XofiGaGspyG2BW+FMCfGlj5tLfPxoYIuMdbpahT8kHWYptj/rcll z5Psny/NcYTikFZlsadoE3MjaT2k56VJ5rM7ZCmiFNDnNCovefuYkTY+WHh71DXsYkbQ 8nNLJvCjfNQ/8MGQCpLMHgBaJJ13VK3YDJOnA1SyctzEZiD0T+DXMZvTS4WMLUNZp3lt uAH3I2CKaPIEMNcDInQ7RQc3KfDMKB9FenhWD5Lxt8tRXiwRvSE3FXcElP0TjPPZTvci b4bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694425670; x=1695030470; 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=4+dyOdEpvdrL2eUxAXXyGxIB/NcoZnEV+TKBfmBMmgQ=; b=aIOEy2mHzqR5+pp/HLzA0lh4lmm4EPg+8wTdSb34dPpJwNUi8UFUTFehUguTJYadri B3OQY9Q7Cgqv1Zwqz36PpSONwns+5C1OqeAMh4mQYJyG/jGTa8aSV3jApEMzGsQozT1u JVD1Gzafcj2mPKYDvzUO8XlpANVywnK5IdKavMUx4+12F2RoAxlLLuTNHHmfJid4PSBO PkO93iJziSpa7gLB8tNLf5aLKZwAtXKGK4L0dfeB2Z/NppNq1UHjvzeFTgTNCxleh3SZ wY2R1rvq61uFAmU7yLsewFUQWMiM5RAJAw9eMVUwpQMFJ0thi2MPBXTCWZr9HHbL2mj1 LeQw== X-Gm-Message-State: AOJu0Yw4SkYDCfWwY/uWOzPpOF/hoDwTEUPnnEXmZvYezWJysZ+iUTgW SRP2j7THlUdrDjCgqoF9jcLNqQ== X-Google-Smtp-Source: AGHT+IFJHaBKDBa9FsHXtzux2UkvFgC3UTp4BhhdsEjv8fCLAr/6/KNue5g8DvDfgdf99+Ek70M0DA== X-Received: by 2002:a17:902:ec8b:b0:1c0:cbaf:6939 with SMTP id x11-20020a170902ec8b00b001c0cbaf6939mr11608160plg.3.1694425670620; Mon, 11 Sep 2023 02:47:50 -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.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 02:47:50 -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>, Chuck Lever <chuck.lever@oracle.com>, Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>, Olga Kornievskaia <kolga@netapp.com>, Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>, Trond Myklebust <trond.myklebust@hammerspace.com>, Anna Schumaker <anna@kernel.org>, linux-nfs@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v6 18/45] sunrpc: dynamically allocate the sunrpc_cred shrinker Date: Mon, 11 Sep 2023 17:44:17 +0800 Message-Id: <20230911094444.68966-19-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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RxqmHfAjApmYP06FsEz7HbZyX9dpJ1U /GSUBMUu U6ykEqrPiq5bFt1tEIZUqutdQwNG5JX6UruhqnTsXDxV8DKjLbBKIRKp6J25/GPUKmaQnwSMsdANHILsVg4cwUyE/RgweI46fdVEAMsx6R0JIBjlfErJQJNOYWsHMkAmd8XYpVdocPK3Z/u7JPIPreYT3SU+L8rW5zKre4PNtiHgA3VJHQcUMZR2PtBQa2PfxFmACnwrkCtN68kFgTF8+961Qc81L0lH9eiOtt70+HNqx2Hsei0bBRG9VSqzM98+IOFQs2mbzdAKX0ay8NttXVV5RSiMOs75wv/XVMa8u9nhk7ABB5F461Hz0mtlz29JVO01cbX3cnS9nfr+1H0RPF0Yh5bp1hE+ActXPJgTTx0TLWqhdFMDCupeK81QAwHD8aCQHD4qk8XGE+ZGZLZRgNbVF8p3pth9dMg5lW6e+lixX3CK2HC0uvq1ndaI68F2IJhNk49k/4Q/CAqelY+yKBUEBRMoDspe0UqWjPehKJws76AqDvIscJzm4oDVp1lqhGicqxOUhJ3GMwB0HHh8AJSbq2qoQCSFNOITkpjl/6iMtRl0NpCYWAtuAnKvJN3YBAleKBNTafeyK7dx3ljxEUP0BL1KcZkaHU7KOSqcpyOfN/OE6JO8M9D1UjskSEHAmacHzPwzglBhZREfG2WnSQ+LQL7lcTj34obB93j+d40UXxhkvd9dRUC8EGxGBZpT5dA3ECK9zIqAf+o0leHETeizxjQ== 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/net/sunrpc/auth.c b/net/sunrpc/auth.c index 2f16f9d17966..c9c270eececc 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -861,11 +861,7 @@ rpcauth_uptodatecred(struct rpc_task *task) test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0; } -static struct shrinker rpc_cred_shrinker = { - .count_objects = rpcauth_cache_shrink_count, - .scan_objects = rpcauth_cache_shrink_scan, - .seeks = DEFAULT_SEEKS, -}; +static struct shrinker *rpc_cred_shrinker; int __init rpcauth_init_module(void) { @@ -874,9 +870,17 @@ int __init rpcauth_init_module(void) err = rpc_init_authunix(); if (err < 0) goto out1; - err = register_shrinker(&rpc_cred_shrinker, "sunrpc_cred"); - if (err < 0) + rpc_cred_shrinker = shrinker_alloc(0, "sunrpc_cred"); + if (!rpc_cred_shrinker) { + err = -ENOMEM; goto out2; + } + + rpc_cred_shrinker->count_objects = rpcauth_cache_shrink_count; + rpc_cred_shrinker->scan_objects = rpcauth_cache_shrink_scan; + + shrinker_register(rpc_cred_shrinker); + return 0; out2: rpc_destroy_authunix(); @@ -887,5 +891,5 @@ int __init rpcauth_init_module(void) void rpcauth_remove_module(void) { rpc_destroy_authunix(); - unregister_shrinker(&rpc_cred_shrinker); + shrinker_free(rpc_cred_shrinker); }