From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31551C0015E for ; Thu, 27 Jul 2023 09:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2b9nrXu4qF0ha/MZeV88SgGcoUe0slOnY8IzTHAFpeI=; b=PcHyoWcWevbYeT 0zeyghHpQDVt2PiZm+KlPGApRe8ysxn5dsF4O+gLjwC8aI/1rbtWnUpdD0Ko01piZZCu66p4g1i9S e2hHrzAaPpF2oz1VvZphhh3AV9uLEninanhPu0ZI8wYLpx133QE61wuD9yweRxkCOhz9Lyx9s1fOr FpHAPfcfzaG/O8DHxQBQKl3i4xV7aYMF+DJHeEYFYalg7oC373e0fU2aO9itZ+ls5guMNWhO1vbfd dW5UMtZw2mbpiFhDVufXTXK7HNQBFqwdHApm+kBZk/anS+7EY9J79CPu0mtI1hafwpXRIAJZ8KEmh It71rYWI5bh7+Bt2sb/w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qOx1h-00CnEp-0M; Thu, 27 Jul 2023 09:11:17 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qOx1e-00CnDg-01 for linux-mtd@lists.infradead.org; Thu, 27 Jul 2023 09:11:15 +0000 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-66d6a9851f3so177059b3a.0 for ; Thu, 27 Jul 2023 02:11:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1690449072; x=1691053872; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=cACJ3NT7rSPHksG1CSCDv/QZVUluNTqq4KXvaW886oI=; b=lKnOasFRjAEbGh7P40XbzLKtOkahlmVFUDvqCWW3ZgaRuzNJSwp4sTaKgMwNwz+Jpc hA4nVDJPH5aqf4q8bVxcWLUkzXpK23oeAFnlJRwJaEUIleLrrgs7btXzJpx3+9HaPfQV hGIP/T6lERVA8hpdk6KZN9Q4J/+wilHe5ZItz/9QQ1qHO3gv2Y4k+BaS5cDcOKz/WLAL 6NaRvNv6KF2mZ19RDXY6rbQZ5sQKyx2Yj2LrfaBgxjqmYdHbumQCN0WmWtbB+gjDIGzm PXmUTQGLOY5T8H3PnVo3H27NG4eQhipuKvHt4yAhK97ujnI+IJGqA8lmlUO0fy4wYeay +oXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690449072; x=1691053872; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cACJ3NT7rSPHksG1CSCDv/QZVUluNTqq4KXvaW886oI=; b=JuOXww0oMRCPEVhoeEjNHTwTOufacs2OFJCtoj/j5e/AD4Mt+vS8NW9+KcZfNr+5Hz UZTCh8C+ip2wpc6UyGPDWV/NNqJsUHJw5dKPDBuYF6qojKjlg8szv/0CwpUAxFw52LvU Rm13STHKkIFMnhYoHxcPwgPNKz8XFud+/9R8Oag6BXqorZ/FMvtZx9+/oMT7shFNhTUm 9QL3YB6aOEO8Mr82fpe/rjvDe3/7D41GCgDyi4seVzHd7hVds+cJexstjnp20J2OBylz 2onB2PYJnlEghcpx5NJbLeMdZfBMbI6Sp4X/i0mOD7k8qvNyTjMX7T8q+hXGBK6AynnU LVgg== X-Gm-Message-State: ABy/qLb0qXx8kxlYecbTolX+TiEYCiGikdI2Fqsl47PVvKytKEjevIEr BJXYSyd2oq7/eLT9LrbYLTPMrg== X-Google-Smtp-Source: APBJJlFfFWIsc+pfSeu4dzuDSzimKXTbXaekoL0gFKsbHel8kB/qljY4u0PtyM2mUW/wDh3jQGEPVg== X-Received: by 2002:a05:6a00:2d82:b0:675:8627:a291 with SMTP id fb2-20020a056a002d8200b006758627a291mr4692915pfb.3.1690449072033; Thu, 27 Jul 2023 02:11:12 -0700 (PDT) Received: from [10.70.252.135] ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id h4-20020aa786c4000000b00682a99b01basm1038080pfo.0.2023.07.27.02.11.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jul 2023 02:11:11 -0700 (PDT) Message-ID: <1eb30b9e-c43b-b81e-4d96-5d6fa4f2894a@bytedance.com> Date: Thu, 27 Jul 2023 17:10:57 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v3 22/49] sunrpc: dynamically allocate the sunrpc_cred shrinker Content-Language: en-US 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, Muchun Song References: <20230727080502.77895-1-zhengqi.arch@bytedance.com> <20230727080502.77895-23-zhengqi.arch@bytedance.com> From: Qi Zheng In-Reply-To: <20230727080502.77895-23-zhengqi.arch@bytedance.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_021114_044610_92183CAA X-CRM114-Status: GOOD ( 16.23 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On 2023/7/27 16:04, Qi Zheng wrote: > Use new APIs to dynamically allocate the sunrpc_cred shrinker. > > Signed-off-by: Qi Zheng > Reviewed-by: Muchun Song > --- > net/sunrpc/auth.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c > index 2f16f9d17966..6b898b1be6f5 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) Here should set err to -ENOMEM, will fix. > 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_free(rpc_cred_shrinker); > } ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/