* [PATCH] fs: nfs: return per memcg count for xattr shrinkers
@ 2020-09-27 11:42 Yang Shi
2020-09-30 20:46 ` Frank van der Linden
0 siblings, 1 reply; 2+ messages in thread
From: Yang Shi @ 2020-09-27 11:42 UTC (permalink / raw)
To: trond.myklebust, anna.schumaker, fllinden
Cc: shy828301, linux-nfs, linux-fsdevel, linux-kernel
The list_lru_count() returns the pre node count, but the new xattr
shrinkers are memcg aware, so the shrinkers should return per memcg
count by calling list_lru_shrink_count() instead. Otherwise over-shrink
might be experienced. The problem was spotted by visual code
inspection.
Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Anna Schumaker <anna.schumaker@netapp.com>
Cc: Frank van der Linden <fllinden@amazon.com>
Signed-off-by: Yang Shi <shy828301@gmail.com>
---
fs/nfs/nfs42xattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c
index 86777996cfec..6e5f34916937 100644
--- a/fs/nfs/nfs42xattr.c
+++ b/fs/nfs/nfs42xattr.c
@@ -882,7 +882,7 @@ nfs4_xattr_cache_count(struct shrinker *shrink, struct shrink_control *sc)
{
unsigned long count;
- count = list_lru_count(&nfs4_xattr_cache_lru);
+ count = list_lru_shrink_count(&nfs4_xattr_cache_lru, sc);
return vfs_pressure_ratio(count);
}
@@ -976,7 +976,7 @@ nfs4_xattr_entry_count(struct shrinker *shrink, struct shrink_control *sc)
lru = (shrink == &nfs4_xattr_large_entry_shrinker) ?
&nfs4_xattr_large_entry_lru : &nfs4_xattr_entry_lru;
- count = list_lru_count(lru);
+ count = list_lru_shrink_count(lru, sc);
return vfs_pressure_ratio(count);
}
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs: nfs: return per memcg count for xattr shrinkers
2020-09-27 11:42 [PATCH] fs: nfs: return per memcg count for xattr shrinkers Yang Shi
@ 2020-09-30 20:46 ` Frank van der Linden
0 siblings, 0 replies; 2+ messages in thread
From: Frank van der Linden @ 2020-09-30 20:46 UTC (permalink / raw)
To: Yang Shi
Cc: trond.myklebust, anna.schumaker, linux-nfs, linux-fsdevel, linux-kernel
On Sun, Sep 27, 2020 at 04:42:20AM -0700, Yang Shi wrote:
>
> The list_lru_count() returns the pre node count, but the new xattr
> shrinkers are memcg aware, so the shrinkers should return per memcg
> count by calling list_lru_shrink_count() instead. Otherwise over-shrink
> might be experienced. The problem was spotted by visual code
> inspection.
>
> Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
> Cc: Anna Schumaker <anna.schumaker@netapp.com>
> Cc: Frank van der Linden <fllinden@amazon.com>
> Signed-off-by: Yang Shi <shy828301@gmail.com>
> ---
> fs/nfs/nfs42xattr.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c
> index 86777996cfec..6e5f34916937 100644
> --- a/fs/nfs/nfs42xattr.c
> +++ b/fs/nfs/nfs42xattr.c
> @@ -882,7 +882,7 @@ nfs4_xattr_cache_count(struct shrinker *shrink, struct shrink_control *sc)
> {
> unsigned long count;
>
> - count = list_lru_count(&nfs4_xattr_cache_lru);
> + count = list_lru_shrink_count(&nfs4_xattr_cache_lru, sc);
> return vfs_pressure_ratio(count);
> }
>
> @@ -976,7 +976,7 @@ nfs4_xattr_entry_count(struct shrinker *shrink, struct shrink_control *sc)
> lru = (shrink == &nfs4_xattr_large_entry_shrinker) ?
> &nfs4_xattr_large_entry_lru : &nfs4_xattr_entry_lru;
>
> - count = list_lru_count(lru);
> + count = list_lru_shrink_count(lru, sc);
> return vfs_pressure_ratio(count);
> }
>
> --
> 2.26.2
>
Yep, thanks.
Reviewed-by: Frank van der Linden <fllinden@amazon.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-30 20:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 11:42 [PATCH] fs: nfs: return per memcg count for xattr shrinkers Yang Shi
2020-09-30 20:46 ` Frank van der Linden
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).