diff mbox series

[v2,-next,11/15] sunrpc: use vfs_pressure_ratio() helper

Message ID 20240903033011.2870608-12-yukaixiong@huawei.com (mailing list archive)
State New
Headers show
Series sysctl: move sysctls from vm_table into its own files | expand

Commit Message

yukaixiong Sept. 3, 2024, 3:30 a.m. UTC
Use vfs_pressure_ratio() to simplify code.

Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
---
 net/sunrpc/auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anna Schumaker Sept. 4, 2024, 7:45 p.m. UTC | #1
On Mon, Sep 2, 2024 at 11:31 PM Kaixiong Yu <yukaixiong@huawei.com> wrote:
>
> Use vfs_pressure_ratio() to simplify code.
>
> Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
> Reviewed-by: Kees Cook <kees@kernel.org>
> ---
>  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);

Looks fairly straightforward to me.

Acked-by: Anna Schumaker <anna.schumaker@oracle.com>

>  }
>
>  static void
> --
> 2.25.1
>
diff mbox series

Patch

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