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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12C33E77184 for ; Thu, 19 Dec 2024 10:20:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 86E046B0085; Thu, 19 Dec 2024 05:20:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 81DFE6B0088; Thu, 19 Dec 2024 05:20:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E5636B0089; Thu, 19 Dec 2024 05:20:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4FBC16B0085 for ; Thu, 19 Dec 2024 05:20:33 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CD16E160D4A for ; Thu, 19 Dec 2024 10:20:32 +0000 (UTC) X-FDA: 82911313380.12.FF9D1C9 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf28.hostedemail.com (Postfix) with ESMTP id 16BB0C001F for ; Thu, 19 Dec 2024 10:19:53 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734603609; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v/XvIzP/qavpY+o5UiOJ3iQ2s8QpQ82HAJLZhAqdKnM=; b=T/SrcV43AumUkJlr3JyIhlh76twKjOXAZjdwyPjNZhFNr47CwGLM3V+7z09EzVI4CYrFps B62l4xMNwYoAM84o3GX5TuQTaUiyF+bnetXODIidZu4HJpbdZRu7G6b/GrogFNhx53ADQB c6XUCKwdQ7hjsphAfubqBJZXKpnCv8Y= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734603609; a=rsa-sha256; cv=none; b=6qWnIsuzYYiiT4CcfufwiqtbRRpQtvQEwUNmC9t95X5eccP13sNm73beQhkHqf5itgCnt5 /2gUcUFvlBGLqrlpq/UVTrOHtO+K/IIzV2dz+XIGtQEOU0lcfTtHcja6AohZyS7aYzKD70 +0BVyxBfDPolc+UJh8e76kXcqwoqZxg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of yukaixiong@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=yukaixiong@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4YDRMr3q9XzRjrm; Thu, 19 Dec 2024 18:18:32 +0800 (CST) Received: from kwepemh100016.china.huawei.com (unknown [7.202.181.102]) by mail.maildlp.com (Postfix) with ESMTPS id 39D8F1402E1; Thu, 19 Dec 2024 18:20:26 +0800 (CST) Received: from [10.174.179.93] (10.174.179.93) by kwepemh100016.china.huawei.com (7.202.181.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 19 Dec 2024 18:20:22 +0800 Subject: Re: [PATCH v3 -next 11/15] sunrpc: use vfs_pressure_ratio() helper To: Jeff Layton , NeilBrown References: <> <12ec5b63b17b360f2e249a4de0ac7b86e09851a3.camel@kernel.org> <172859659591.444407.1507982523726708908@noble.neil.brown.name> CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , From: yukaixiong Message-ID: <3efccfae-3f76-c99c-29f9-fdf5dd65894d@huawei.com> Date: Thu, 19 Dec 2024 18:20:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.93] X-ClientProxiedBy: dggpeml100004.china.huawei.com (7.185.36.247) To kwepemh100016.china.huawei.com (7.202.181.102) X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 16BB0C001F X-Stat-Signature: zwojaoasjqx9escn81mpophji6szrorn X-Rspam-User: X-HE-Tag: 1734603593-495184 X-HE-Meta: U2FsdGVkX19piv5K6A9ujJVjtgJMOlhv+CAH8kO9f9IjxPSoo9+t7YFyWlAUjntGwTk+U3/4VGAP5wNmGkfhtgDNU89qo380JoNRXh9Q6rursI9q5DadB6J2zzm6/QWwO2fHSn6YNz7OKooi5ptAH/I6pmzO83heZiJW3PDvfJ1XaVabJlNK7GVGk6GebdpNa/aNrqfM9wXvSUfPqrzFgRkrO44C4dUjHbilaOLaoNe2YoSGEzg7Tk6LsJNmWnaQn3j67hBKChzoVOkvuOmtnndXMLUPBGj+wtUyfbPAUYDYPr8aZs0p8/whoVRj3QU1hYAtgU97wJbdOwVQK8AeXzFQW0EZE+KJs57/5iWWbvtEP42aeJeuxHq7iqHfaYawhU45RrEvAowhlDUsR2fwWDY4PfY2FVeBNB8BtJl8DWvE89cTU5kb3I1/ULMjwIZa4J1e0SyetM/hcxNE2Wd2nEIMDi/A2CuHxbb/5nA3RpsyfItEeFNctVR79+iUN3PjKAoRJRJQ/8g4IxkxtbBhhfmH6doTIRpsOOhCWIZujt3OWY3QUzyZHPoTusg7RjjTx7D0x8DzNdkkX2Er9b9wdVkr7YbepG7S56yErJHx0s2n71rFzT5ZWCv+kbKUf6gdrbD4+6i+w5yQ9suFdPt/RDnv6fmFMZjVqtMhVDyQ9grYiR5lZ1S5k44/sc7NTieiDI+CuTUgGWQgGWgac14fyVS9jsOw5K5p2R2ZjGs5dSI2CxspbgTfN/YzE5X8M9xo4K5mmXL2RYrfu95M7GARq+oTvAhFJQ1mHrUIPmDBBHs3Po223VEQ+7d9dMJNSno6Swjzup/f6uFUdcdhpwR7PkVZFY97tKmU7xQaOJo03tTjf46vrcMudZXiM+s1+30GR0sUrKgGiPR8OGEUq4/wVmYRU9WBM9Iv9FzsZ7m4iKqX8i0dFu6v1EmXPT9RgXRWvuVPDiAoJCiw6PyZs7e 9IEquAiV GrDqVFEsEVDtSg00gJrIOChRaP4hpdIqXYU6cDDNKzKkho65c0E1BOO+3zDy49IviPil7ASlhOfH61kS/S4SL7W9r6zOPuQHKTfWg7Hy9p2eJ0OphvWopNW+vvutyK/aSO1ugUVqu+QxGBD32FC/1y6ZUZT578dNjX8a2wxtGXonBaR+dU5UR1BmxkjeuDJ8Zf7nm9TnzTK4ZgcmVRSH4znGj1WoqfeGZ/v3zS7jN7/odT+kKC0ZLwvk2zkcexSp6mRF/ 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: List-Subscribe: List-Unsubscribe: On 2024/10/11 20:38, Jeff Layton wrote: > On Fri, 2024-10-11 at 08:43 +1100, NeilBrown wrote: >> On Fri, 11 Oct 2024, Jeff Layton wrote: >>> On Thu, 2024-10-10 at 23:22 +0800, Kaixiong Yu wrote: >>>> Use vfs_pressure_ratio() to simplify code. >>>> >>>> Signed-off-by: Kaixiong Yu >>>> Reviewed-by: Kees Cook >>>> Acked-by: Anna Schumaker >>>> --- >>>> net/sunrpc/auth.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c >>>> index 04534ea537c8..3d2b51d7e934 100644 >>>> --- a/net/sunrpc/auth.c >>>> +++ b/net/sunrpc/auth.c >>>> @@ -489,7 +489,7 @@ static unsigned long >>>> rpcauth_cache_shrink_count(struct shrinker *shrink, struct shrink_control *sc) >>>> >>>> { >>>> - return number_cred_unused * sysctl_vfs_cache_pressure / 100; >>>> + return vfs_pressure_ratio(number_cred_unused); >>>> } >>>> >>>> static void >>> Acked-by: Jeff Layton >>> >> I realise this is a bit of a tangent, and I'm not objecting to this >> patch, but I wonder what the justification is for using >> vfs_cache_pressure here. The sysctl is documented as >> >> This percentage value controls the tendency of the kernel to reclaim >> the memory which is used for caching of directory and inode objects. >> >> So it can sensibly be used for dentries and inode, and for anything >> directly related like the nfs access cache (which is attached to inodes) >> and the nfs xattr cache. >> >> But the sunrpc cred cache scales with the number of active users, not >> the number of inodes/dentries. >> >> So I think this should simply "return number_cred_unused;". >> >> What do others think? >> >> NeilBrown >> > -----------------8<------------------ > * @count_objects should return the number of freeable items in the cache. If > * there are no objects to free, it should return SHRINK_EMPTY, while 0 is > * returned in cases of the number of freeable items cannot be determined > * or shrinker should skip this cache for this time (e.g., their number > * is below shrinkable limit)... > -----------------8<------------------ > > number_cred_unused does sound like a better way to report this. Thanks, I'll take NeilBrown's advice.