diff options
| author | Shakeel Butt <shakeel.butt@linux.dev> | 2026-11-11 17:32:20 -0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-11-22 22:24:12 -0800 |
| commit | 391f7207cb876b1f68368f2f7aed5abfb242a5ea (patch) | |
| tree | 6e57412762694a739534db256fbf31234566931c /tools/perf/scripts/python/bin | |
| parent | 9436a736a148e3499cc1932b866d840803fbf764 (diff) | |
memcg: flush nr_charged_bytes when the obj stock trylock fails
When interrupt code, such as an RCU callback in softirq, runs on top of a
task that holds the obj stock lock, its trylock fails and the bytes go to
objcg->nr_charged_bytes. Nothing empties that counter while every CPU
using the objcg keeps it in its stock, so it can grow without limit.
Users see memory.current and the "kernel" field of memory.stat keep
growing while the cgroup's real usage does not. With memory.high or
memory.max set, the cgroup is reclaimed, throttled or even OOM-killed for
memory it does not use. The counter is 32-bit, so after 4 GiB it wraps,
and those 4 GiB stay charged to the cgroup and its ancestors until reboot,
even after the cgroup is removed.
Fix it by uncharging the whole pages in nr_charged_bytes whenever the
trylock fails.
Link: https://patch.msgid.link/20261112013220.4064478-1-shakeel.butt@linux.dev
Fixes: 200577f69f29 ("memcg: objcg stock trylock without irq disabling")
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Chris Mason <mason@kernel.org>
Acked-by: Muchun Song (ByteDance) <muchun.song@linux.dev>
Reviewed-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>
Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: <stable@vger.kernel.org>
mm/memcontrol.c | 2 ++
1 file changed, 2 insertions(+)
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
