mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tools/cgroup: sum shrinker object counts across NUMA nodes
@ 2026-09-30  6:03 Ren Tamura
  0 siblings, 0 replies; only message in thread
From: Ren Tamura @ 2026-09-30  6:03 UTC (permalink / raw)
  To: akpm; +Cc: roman.gushchin, linux-mm, linux-kernel

Each row of a memcg-aware shrinker's debugfs count file contains the
cgroup ID followed by one object count per NUMA node. memcg_shrinker.py
uses only the first count when sorting and displaying entries.

This undercounts objects on NUMA systems. An entry with counts of 0 and
23 is treated as zero and omitted from the output, even though its total
is 23.

Sum all count fields after the cgroup ID so that the displayed totals
and sort order account for every node. Single-node input retains the
same result.

Fixes: d261ea23533b ("tools: add memcg_shrinker.py")
Assisted-by: LLM
Signed-off-by: Ren Tamura <ren.tamura.oss@gmail.com>
---
Validation (2026-09-24, mainline 62f4c998b297): ran the original and
modified scanner and display code on Linux against count-file fixtures.
Multi-node counts changed from 0/7/4 to 23/18/4, while a single-node
count of 9 stayed unchanged. This validation uses fixtures, not a live
NUMA shrinker workload.

LLM assistance: finding small cgroup fixes, drafting code and commit
messages, and preparing validation.

 tools/cgroup/memcg_shrinker.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/cgroup/memcg_shrinker.py b/tools/cgroup/memcg_shrinker.py
index e81c3017ada9643de72d9fcb5e8fb6808382a31b..714772449c6ba9142215e88cf9e4526bdbcb9ee6 100644
--- a/tools/cgroup/memcg_shrinker.py
+++ b/tools/cgroup/memcg_shrinker.py
@@ -31,7 +31,7 @@ def scan_shrinkers(shrinker_debugfs):
                     items = line.split(' ')
                     ino = int(items[0])
                     # (count, shrinker, memcg ino)
-                    shrinkers.append((int(items[1]), shrinker, ino))
+                    shrinkers.append((sum(map(int, items[1:])), shrinker, ino))
     return shrinkers
 
 

base-commit: 551c722f40809618230001baccf219193e22fc5a

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-30  6:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30  6:03 [PATCH] tools/cgroup: sum shrinker object counts across NUMA nodes Ren Tamura

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®