Re: [PATCH] mm: shrinker: stop counting when the seq buffer overflows
From: Muchun Song
Date: Fri Nov 20 2026 - 06:49:35 EST
> On Nov 20, 2026, at 19:05, Xuewen Wang <wangxuewen_ky@xxxxxxx> wrote:
>
> From: Xuewen Wang <wangxuewen@xxxxxxxxxx>
>
> The shrinker debugfs count file uses single_open(), so all memcg rows
> belong to one seq_file record. When the buffer overflows, seq_file grows
> it and retries the entire record. Queries for subsequent memcgs in
> an overflowing pass cannot contribute to the final output.
>
> Stop the traversal once seq_has_overflowed() is true, using the existing
> mem_cgroup_iter_break() path to release the current memcg reference.
> Leave the overflow state intact and return zero so seq_file can retry.
>
> Signed-off-by: Xuewen Wang <wangxuewen@xxxxxxxxxx>
Acked-by: Muchun Song (ByteDance) <muchun.song@xxxxxxxxx>