Message ID | 20230724094354.90817-21-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 929F0C001DE for <linux-mm@archiver.kernel.org>; Mon, 24 Jul 2023 09:49:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 32EE0900004; Mon, 24 Jul 2023 05:49:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B83D6B007D; Mon, 24 Jul 2023 05:49:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 131B2900004; Mon, 24 Jul 2023 05:49:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 017D46B007B for <linux-mm@kvack.org>; Mon, 24 Jul 2023 05:49:09 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CE8FE1608C2 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:49:09 +0000 (UTC) X-FDA: 81046032018.30.884552D Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by imf28.hostedemail.com (Postfix) with ESMTP id CE7BCC0013 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 09:49:07 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Om2j7Eq4; spf=pass (imf28.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.180 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=1690192147; 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=3CXd5cxT7BQDd98tt8oaC0MvbTuhoGV4WCiM7GrnKVE=; b=siHxmpp1OLcGiN3Mdl958xaJ8vB1ILGMwS3tMbjzU6xNypiHtHXB8asJ88CF2oSLV8EAq8 KPorDGUklvoJen/PMmd6oy1hjleGuvWYDt73EVx4Ct0kDsc/luruUpCXjh74vpimVRTWE8 uxb3SF7nChyT3ngT3PXdDzgZR/oDwos= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690192147; a=rsa-sha256; cv=none; b=bjMxBMMbtCCwH1P6vG/BSMldnLwaWiHLfDkboZemHUGMe8JDYMrOZe7V72T4SZJdr2XVdS +ROeUqqE2DH70Ov7Uq3FLREjC9r87G+qMJCBUFsaozECb31ZUVKf1eV1PbydYK6NC3KaO3 7WGOIrnf2DqEsuhcBQQB5uS6HcfVc4M= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Om2j7Eq4; spf=pass (imf28.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.180 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1b8c364ad3bso8860915ad.1 for <linux-mm@kvack.org>; Mon, 24 Jul 2023 02:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690192146; x=1690796946; 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=3CXd5cxT7BQDd98tt8oaC0MvbTuhoGV4WCiM7GrnKVE=; b=Om2j7Eq4b1zO3xdV6jpRgZNyxXUYFkRHVqkn+q5W951pJcNCyyCCfcFLMOexVrickD J4ocoN591zedkzE2l/xp9SKWxYNmVY9krcCZp1enxIDkg3AuGZslR02ZNhQ4EqRsU2HZ PP0+JI5GQi1EzLTs4k94q0v4nCvWQ/wpATlpWJHquPmCZ9F29qdBLMIvq7n3uMU0LBE+ S5G8d6zEmU4sF3lI0zmYqBRm2zlIoJryhG+DWOUkdilD+QmzqjFCVIDjtSm2UD8IjhcW 4f3Go/NoxA8FuaENkugEjSaXcGkVRUNsilnpPO5VZgwHu2urEIWQPvH/FMxPOeDNA9uj omeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690192146; x=1690796946; 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=3CXd5cxT7BQDd98tt8oaC0MvbTuhoGV4WCiM7GrnKVE=; b=caN6J7K0IXuu5FkEd+HK+rtzI+0FYIpQO8UBfWlKqm0Q5TkIBKsAQei94hJlz1XzAx 7j4nGFAJ0JCsaO+EuPv8htpmSGStscagSXEGve0Y/D4ScYTFkrD30DN1Uu4KphsFhKIT B2VKs1hItqgJIX6d24pWN2wU94KlUW2NhvtWEDJlErxdgQnZpSNFJ/nNwxYZMUL6b/Ag +60g8HTn1lkxPJ1kbPOZtVBh6vDysznRS6ZjMTyKwoZHhTX3kaZLmqfAKyBU/nTGXzVQ qTgh1SHQkVl0kkK0NP/fwr/973dVx4gDuHlAflROkVM84TxkaaDayRoTsCZs3RVQzg5m 7Gzw== X-Gm-Message-State: ABy/qLbstm28H7IGkZNC+zVY7KvlF0rwhxpWaVAusedscLQVH2irPgUR u5N3qB9XYLoAzt6xV0FhT+wNew== X-Google-Smtp-Source: APBJJlGIkgxKi3c8vlsRfvF8eC2AUaCtjB+PIQLMdMMArsufsHEWiltHfQyyqXBdYUy9SpebX4CtOg== X-Received: by 2002:a17:902:e80a:b0:1b8:50a9:6874 with SMTP id u10-20020a170902e80a00b001b850a96874mr12324079plg.5.1690192146760; Mon, 24 Jul 2023 02:49:06 -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.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jul 2023 02:49:06 -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 20/47] sunrpc: dynamically allocate the sunrpc_cred shrinker Date: Mon, 24 Jul 2023 17:43:27 +0800 Message-Id: <20230724094354.90817-21-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: CE7BCC0013 X-Rspam-User: X-Stat-Signature: 3tsyz354gaq8zus1zokorex5b1ux76uh X-Rspamd-Server: rspam03 X-HE-Tag: 1690192147-974400 X-HE-Meta: U2FsdGVkX18oWu4CkAfwscjAS1yyQHU/3ssVzJO24umk+NzPYteOMvwMruBMGxpHqO0sbhqVGGOPl5q9YtVO/4+KfeNYj7d3D6GOjKBmNzobXYc0x47MKMKFkN6rFbKjaiQcJwDEohiaPKiQD6yrBohFWzE0nc4TuCrux6YA+7Pt1xzWAp1gTQh+//SLJMvuyqeh7iT1JxCiE7cAq1FK0vWxz7+0pzqpcbgpdwZARbV/I6dlQGcaUkcGjRix8m7Budjx0glJWvRXg4PXA1k6vQ6SGX5V3/NAJaWSvXz0UAtY4nuOxkVMduwRpRrC8lssR+3TfTqfi/t7dhcSgk/Mly8YABxkvwCHn5aYm6rNhIEv18S8myNNU/dCj0n3ae80i+Aq8JXrZHfcQpwPwnWf53Fe0NX3QZYqS4MqCMTAfS3Y9wbywx40V+Ad82CKchmB1atXhVC1m0LrMlGxugo3uWPXUtSlUujzH3KU6a7zqq3MH7SHLVxHBiIdckX63td8RLJEK6X4G5vkTF19K14uUdehLoFZxh3fEql1hrjLse9/55jOFZi5Mcq3TIXCIaZ4B9zxp5Ns1hmnoQkaL15GNsKGG6hYx8dT8OBPVAtT9AoCEviQTT/SuW6KrHw+EM/y0c9AcaoV8fmiOjfcv73xhPPuWHSfiuFjmPI5g3MtuSwXd6U28t90IwSsp9a3RVQd44kzZEgGxnc4bNqEl0i4Fd3ZercBJ0tr8paVN1/3r2dY+DHE6NTNEc9HnnfMqU7NSUVzxCRX2XAXGfTOSg9Y5jKtNsD23ZFKGrMHFDSuKWfMMqbQPqdc9P01TdlEbaoIjJRBlpBkCz6/8b/oIXuGtxczjcDy6JBedh27Q9iRLyY7dLMLkVIzWYNZLZD7VLRtgsU62G7FoieSrgqqBcjifFT4WVbZhzOIKDumX3OEKsepAwK6e4HzkBrt2ufDzN2PCpQ3cNHUIPQOxBN8NIL +NTEBcXG bd8I7i1ErPsxeXer1j/m2gY3qTfE37qzPX89CmvZdbHbcOLNzuKXmi7fA5fUkfoJaGlY8W0d9aAHLaDWsqvkuIrXPgKacBclKu7FFeDCL1HXIXi3JSVK2lqVaFmNsY5fSB8OT+RCmZNLp4yqmOl1wQs53tDWeoaRdmaKSfgHbiudeCmvMKgC9+FPNpT63RSo9EGpMt20C3oj36rL8ORX/VC8lwvnn85pt6bG+M5S7Yv2X+0oWZKTr609/gJfnB3sUUSWTM2+zcEOtkilDzbAHtZQvkrsM6Q9o3dYmM2X1NIi0/rBfolR+BPXWFikSTV0SWwuEpKKpAO84jZjPx0M2VGP5MgKU8/hn1a3xLDiN+q8E4R1HhLEOnNp0HmC9YjPT+2idbEizM8sCOFsLHY1LMKAD/L38Uku08Qu0Mt51k3e6UHWiJEx1PAsZmbO6eVeQIBUeG3OQlFUdJfF/etr+g1FAaw== 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 sunrpc_cred shrinker. > > Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 2f16f9d17966..74e40c8a512d 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,16 @@ 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) goto out2; + + rpc_cred_shrinker->count_objects = rpcauth_cache_shrink_count; + rpc_cred_shrinker->scan_objects = rpcauth_cache_shrink_scan; + rpc_cred_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(rpc_cred_shrinker); + return 0; out2: rpc_destroy_authunix(); @@ -887,5 +890,5 @@ int __init rpcauth_init_module(void) void rpcauth_remove_module(void) { rpc_destroy_authunix(); - unregister_shrinker(&rpc_cred_shrinker); + shrinker_unregister(rpc_cred_shrinker); }
Use new APIs to dynamically allocate the sunrpc_cred shrinker. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- net/sunrpc/auth.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)