From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,roman.gushchin@linux.dev,qi.zheng@linux.dev,
muchun.song@linux.dev,david@fromorbit.com,wangxuewen@kylinos.cn,
akpm@linux-foundation.org
Subject: + mm-shrinker-stop-counting-when-the-seq-buffer-overflows.patch added to mm-new branch
Date: Mon, 23 Nov 2026 16:09:44 -0800 [thread overview]
Message-ID: <20261124000944.B11EB1F000C0@smtp.kernel.org> (raw)
In-Reply-To: <20261123055020.287151-1-wangxuewen_ky@163.com>
The patch titled
Subject: mm: shrinker: stop counting when the seq buffer overflows
has been added to the -mm mm-new branch. Its filename is
mm-shrinker-stop-counting-when-the-seq-buffer-overflows.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-shrinker-stop-counting-when-the-seq-buffer-overflows.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Xuewen Wang <wangxuewen@kylinos.cn>
Subject: mm: shrinker: stop counting when the seq buffer overflows
Date: Mon, 23 Nov 2026 13:50:20 +0800
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.
Check for pending signals first to preserve the existing -EINTR priority.
Leave the overflow state intact and return zero on overflow so seq_file
can grow the buffer and retry.
Tested in a single-node KVM guest with 1024 cgroups each caching 16
ordinary files on ext4. Output remained 8865 bytes with three show
attempts. Count callbacks fell from 3075 to 2472 (19.6%). Six fresh
guests per variant each performed 101 full reads with no probes
registered. The median of guest medians fell from 127.8 us to 114.0 us
(10.7%, about 13.7 us per read).
Link: https://patch.msgid.link/20261123055020.287151-1-wangxuewen_ky@163.com
Signed-off-by: Xuewen Wang <wangxuewen@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Qi Zheng <qi.zheng@linux.dev>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Muchun Song <muchun.song@linux.dev>
mm/shrinker_debug.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/mm/shrinker_debug.c~mm-shrinker-stop-counting-when-the-seq-buffer-overflows
+++ a/mm/shrinker_debug.c
@@ -84,6 +84,11 @@ static int shrinker_debugfs_count_show(s
ret = -EINTR;
break;
}
+
+ if (seq_has_overflowed(m)) {
+ mem_cgroup_iter_break(NULL, memcg);
+ break;
+ }
} while ((memcg = mem_cgroup_iter(NULL, memcg, NULL)) != NULL);
kfree(count_per_node);
_
Patches currently in -mm which might be from wangxuewen@kylinos.cn are
mm-shrinker-stop-counting-when-the-seq-buffer-overflows.patch
prev parent reply other threads:[~2026-11-24 0:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 5:50 [PATCH v2] mm: shrinker: stop counting when the seq buffer overflows Xuewen Wang
2026-11-23 6:14 ` Qi Zheng
2026-11-24 0:09 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124000944.B11EB1F000C0@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=mm-commits@vger.kernel.org \
--cc=muchun.song@linux.dev \
--cc=qi.zheng@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=wangxuewen@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.