Message ID | 20230807110936.21819-22-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 89038C04FDF for <linux-mm@archiver.kernel.org>; Mon, 7 Aug 2023 11:14:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 20D8E6B0078; Mon, 7 Aug 2023 07:14:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1BD456B007B; Mon, 7 Aug 2023 07:14:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 05E378D0002; Mon, 7 Aug 2023 07:14:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id ED5076B0078 for <linux-mm@kvack.org>; Mon, 7 Aug 2023 07:14:29 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CD4C5B19E2 for <linux-mm@kvack.org>; Mon, 7 Aug 2023 11:14:29 +0000 (UTC) X-FDA: 81097050258.18.4652BC4 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf09.hostedemail.com (Postfix) with ESMTP id 11238140019 for <linux-mm@kvack.org>; Mon, 7 Aug 2023 11:14:27 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="E/hLPt4J"; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf09.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.44 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=1691406868; 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=igblsYgdIrcTAL0swCZj529c9jjsKo5CwfFS1Qcng2s=; b=2p5LmRCTttI3l2N2EHBU5JisZ493dzuVUc5dliiJYqGmzLjbulIaKRjQXeeS12M3UV6ipf euHFHvkeUKpNEU+KeTq6uYGy+6hDk94sOxFngATj6tr+ew8gqaL8k/mRZEfYUbn8LMszih 7BoePnQuupryFsMbZIpVUqv9/JxGmU8= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="E/hLPt4J"; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf09.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691406868; a=rsa-sha256; cv=none; b=HTdyBNuMKcUOcwWeCdCAY2jaIYnv5f58nPgNkpZm068Mr7XvnSxs2MymO133DRzW6pXZbl 4oySOsxu7lUDJgy+AOTf3vWWdqczfZfJvHhxvnnWh6i85MekII75FSfHErn7rQBzATxkYr wv6N4FnClOb4ExksQk/dS8Atl80niA0= Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2690803a368so590613a91.1 for <linux-mm@kvack.org>; Mon, 07 Aug 2023 04:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1691406867; x=1692011667; 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=igblsYgdIrcTAL0swCZj529c9jjsKo5CwfFS1Qcng2s=; b=E/hLPt4J9XwFdy6Q/ScFkKAboS35nT/aVetijUs1uOyzpCdXJrzvux0WuTkbJahYDU HJ4RnOFgFoSV4vIvUSABYCFS8MT8O5BBdFRn/e0d22QvpkBHCvD7k0jL91l8VKqh/AnF pNO49bmGYrjFLlyM+it2E7+BjcoRQ4qvC4Z3zAnwRx4Mtu2gDzO6KjINZG5u37W7YPwR rd9mA5oeLZ1tw0ARUeeWuqEeVLZXyyZpLkD+mkbNh9jB2r9y+xHrPRtEaxpg/6wzvL2p pP/svPPe0egiR6EyNxAsA97H1SimGEidDNnScRjB0NSGHk7qAYW8vH7pvvrUaRXF4mmo 0r3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691406867; x=1692011667; 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=igblsYgdIrcTAL0swCZj529c9jjsKo5CwfFS1Qcng2s=; b=YpQYs6Dxcu0ERlCJQ14JjvZIoqldYPn+NNC4AXeogbXC12o9DAg7mzo0/gPBwTAULf HVFfJV8W5jiTvEQgPkdmHaJMUhIR/zCYXeNMTl42vc+pP47jMAegV6MUQnjUbSaJ2ggh gFIh+6eljfn3Sw6uEmds4yIY5gaSSWEuNiKMFD8TRll8UbQwM26wOS3qHvvti4+CJcD5 3D/dBSw3C4pTDhik8SZZqTeflFSHFoOn4LGksTIeXtiC+h9tf+/nSEjkz+Clc9ek/O6X paf5GkNNdXSaqANOPjcEmn7CmHa+C1mh7/SkRKvMNBBzyHkNwqJIHtfVsRU+qDrWrMSx f11Q== X-Gm-Message-State: ABy/qLZqwXo2ul9ZuOBun9e17VMphmsDdJLtyZmE3x+8Bof9FdV3au/9 3OshZVDh//xFBCaubrh01dWX6g== X-Google-Smtp-Source: APBJJlGEDKqK4nyUWs8xE2EOJL+ODt25deDnA1/u8sHRAURqC7uD6bjxMDwwed+SXn6y84Un7sE7wA== X-Received: by 2002:a17:90a:1090:b0:268:126c:8a8b with SMTP id c16-20020a17090a109000b00268126c8a8bmr24570134pja.3.1691406867003; Mon, 07 Aug 2023 04:14:27 -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.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 04:14:26 -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 21/48] sunrpc: dynamically allocate the sunrpc_cred shrinker Date: Mon, 7 Aug 2023 19:09:09 +0800 Message-Id: <20230807110936.21819-22-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-Server: rspam09 X-Rspamd-Queue-Id: 11238140019 X-Stat-Signature: xdk6rpzfikk3nszrihbuecmtg14b1zjb X-Rspam-User: X-HE-Tag: 1691406867-38832 X-HE-Meta: U2FsdGVkX18lH82ZeTdEScHqmQg0XP/F/BTd5kti4UdIsdv1/uojr9eGv9L5mkrr3pOCU+vnMMbJIZMC+SnDAVfXB82DIKrPwCwKiwRMvr7ajPp94dwFxhbq61CXYF9lSSmoeztyd/ki9efpTR6EPGZH/1SlSJ7J8NckSt0O5KlfyxF4VQQ5ATfXhLrBgZFo/2cCPt82KRTL2rDuuowaFJhGhNe2/xpL34bh7joDYV/Hp/F8FXCa1JSgPWL0kPawELTCw/rLg2rsGSzgYAM9lQlmpyZaaZWX4ZwwcNI0n5v5H/YSheYGOG/oJbe9d7xDvs15oWqJEQUxCteD1bYzc9HyDXHsyAvL3qwrr9KJSJszkmE2L1t7u9paVtfMBTOIheeTW0ailznx3OgDMUWwc7XfPj+zQnpk3qRIXJS0Q2WMIA+cvti+H0kUvy7/8OZ9W8Nwo3tqD9OQH+xeqtBGDSfmHjnQfu398OSyzuRIFGRPApopqUaep7J147jsO08D4YkioU8aoKfTKeaTVLxZxMI3kEoaTfVCUCli34kUUfly+tqFc0atac0KJ/MUY2TfCjR636kVJYsXB1Lt7480pMGk0t/kfH74bpLUNBiJFdEF3/fPfCiS88YbQ+aWaNNMfYg/i57YSfgRqqyUqgFubHlebf81uIhUUAAh40JDL+foO984m0AuDku2dW/l+wG+4zjnkGayZshrQMIMyBcUgJ2a9Ue9VN0jGWUanN5IuuxwjfBy7/ntRdk2LjIP/HHDrGSNGU01aHo3yDuOFdOF3NXiuY89UZ0WO2KKui9FyThpcjFXodA77x86YeWHQ6A5jS9gilXE6T+jcjJRmOU9VlGOIlwQtVwxazQcxtpJN9u14QwnQHTMJPcKi/AouTP3ZKDUwmQNKjmQnR+4NTW0sxMztjcvrYorjHzXNkBrumYvHixZ3B680ogQ+Z4aMJfxvqGfgr8iUojos5dft1t pUH6Od4Q WwF9097gwXHtBTcxkPVynf2q4UTptHDlJN5sS8PZdBk4Rw9auzrZzLdAtuN/VMlO7fUAVq4HLWpX8Enjslk43h7HQtGY5ZN8NXkXnKWDfUtAZ5R5m6DXvn+3ExHrHmRkZIMGLqEvRA+icaD8+yDVSlxV+uhbLAcsnT0jAZnUkCD8zkbBlrvd0KAQkFPmIhcXhLu0kwtkwdogaTaQfCd9MR3wTdm4HiRREl4wZ23NcHkup+mQivOuTlPwLa4VC8BuuwTRtvcYungjy0k4Hmv1MoQQiuwDMeOOdAT4LL601kmdOfTt2wJMgbaYvaJfvH4ZNBUYufGikxfR5nALruiqB2X4y9i8j6LgRvCSQpkT/81xWX0u1a14tldJJl0CMARbPI3YPkpjwbiO+4yRq0uOP/MNx8RM3rwk4VLrd1OXZhMD03GtMCn4PQxWdB7WxzMekp7OpkIbfQieqNJrO4xDKlVkYgQ== 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..0cc52e39f859 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,18 @@ 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; + rpc_cred_shrinker->seeks = DEFAULT_SEEKS; + + shrinker_register(rpc_cred_shrinker); + return 0; out2: rpc_destroy_authunix(); @@ -887,5 +892,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); }