Message ID | 20230807110936.21819-22-zhengqi.arch@bytedance.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1425726vqr; Mon, 7 Aug 2023 05:56:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHPmeBXrxsOR3pIBK2T+r5H7mn1yqcH+tHXOTa2ZR3K0BDTWtdQc1FpBsyR1lftwLUrQQTU X-Received: by 2002:a05:6512:b8b:b0:4fb:89ad:6651 with SMTP id b11-20020a0565120b8b00b004fb89ad6651mr6997229lfv.28.1691412995444; Mon, 07 Aug 2023 05:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691412995; cv=none; d=google.com; s=arc-20160816; b=MFgdVo9jzzW8hlS+ySJq/tAEt5O58Wn1qwPJxripmy2eMSFyZmIHvcUFADraHi6dSZ B0XobhZvRNabnO1d86QQNRZ4MXKKo/0v4R08wQTYrbEGs4Z2TEWZSEBbtq0G72Hyyrx6 XAo5AdXP99kJSxwfvb20hAxKvjJzw+O0R6Roj5Ca9TSsbjEs5C43XqXtozsO/BG3w06N QzaabnwPXJ48VH4S499tiLpORvcxCvALrc4+vCdeyx67/vgKoGf2xtCWIMW2YeiPqH2t Kxu1bqWn+JueEc/XoTGMQNz00WjS27NEoDJWhPI3kqn8xbnTXFIY6DeXmBnFk3vXT005 aMlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=igblsYgdIrcTAL0swCZj529c9jjsKo5CwfFS1Qcng2s=; fh=JwrRg0ndXrpURY0vwDVMB2JxbP/kKK+/sa4yghEeBpo=; b=j4ja3XmnEq54yNV3xDf8ibeF75+z2alJroMb95ZM1+/pxsc0K9LiL4oikZ1Nj368HV JCf+VO0+PUgAPcRnO8O4DR7QHeu1NolkRr5GpEEQMjUaZHYj11I++DJbnephulXlujqT VDRdyPg5utNdUGYJD/FlM3TO/JN5czUEr3Z67lVvXoG7S0OXUuwY3pLl6fXNhENjR1GU mcnlGHKShHnS3AR9ttBcBNwbnOL5faldKWsqyNuyKOHhrCJ9PpBqaPlZeEWYblC7j/Ok iEQHOlor8Y8pj8tKJY4wVgRxoW3K8YVm2FrBOTG6O0AVxFkbdzPwvQ2Rcv3ISgL2p4Ya 5IaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="E/hLPt4J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a16-20020aa7d750000000b005221f3c3f0dsi1975783eds.577.2023.08.07.05.56.09; Mon, 07 Aug 2023 05:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="E/hLPt4J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232548AbjHGLX6 (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Mon, 7 Aug 2023 07:23:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232902AbjHGLXe (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Aug 2023 07:23:34 -0400 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0243583 for <linux-kernel@vger.kernel.org>; Mon, 7 Aug 2023 04:20:40 -0700 (PDT) Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-55badd6d6feso571795a12.1 for <linux-kernel@vger.kernel.org>; Mon, 07 Aug 2023 04:20:40 -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=LciKwC3SnXjJhwyiKeR5IK546l1+tNqTzNj/n2CnCi1lpIjGsB53pOG1J7A92y2/tw vJIITiQRr5ibgP/jwqVf/bobRH1wam/YttqXUaHnvgJpDyj2HrpZFe0pvAwK93kA7xay IJ39MH1d4yvZVMk+8DtKgQaudhvbSj06dIdhwMWWdOJXuqow9QKlvsiLYWIhFDLsSX+B RKWvpaUo0nwDcs65f0ARPAij05rph+3QgvezchWESTG5nlwWb/cAeH0gkzQg+emTP5Gu 1dTt7Cu9Tz1I7JQ0cqTAO7Q6sw7bG6i5rsJpV7/YmvzDYSZJMwF/pbfvXjiKv4NNDi2r ol/A== X-Gm-Message-State: ABy/qLYEohXXAizM+u00sKU/tQwhX10qz0CcM+xCCnIPfmODCgHZ4gJ8 FlXTq2tnLm9+nW6uKS1RUhYCtA== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773575072960900084 X-GMAIL-MSGID: 1773575072960900084 |
Series |
use refcount+RCU method to implement lockless slab shrink
|
|
Commit Message
Qi Zheng
Aug. 7, 2023, 11:09 a.m. UTC
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> --- net/sunrpc/auth.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
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); }