tools/cgroup: sum shrinker object counts across NUMA nodes
PATCH 1/1 tools/cgroup: sum shrinker object counts across NUMA nodes
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.
---
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(-)
tools/cgroup/memcg_shrinker.py +1 -1
@@ -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