[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251108022639.73734-1-sj@kernel.org>
Date: Fri, 7 Nov 2025 18:26:38 -0800
From: SeongJae Park <sj@...nel.org>
To: Shakeel Butt <shakeel.butt@...ux.dev>
Cc: SeongJae Park <sj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Muchun Song <muchun.song@...ux.dev>,
David Rientjes <rientjes@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>,
linux-mm@...ck.org,
cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org,
Meta kernel team <kernel-team@...a.com>
Subject: Re: [PATCH] mm: memcg: dump memcg protection info on oom or alloc failures
On Fri, 7 Nov 2025 15:40:41 -0800 Shakeel Butt <shakeel.butt@...ux.dev> wrote:
> Currently kernel dumps memory state on oom and allocation failures. One
> of the question usually raised on those dumps is why the kernel has not
> reclaimed the reclaimable memory instead of triggering oom. One
> potential reason is the usage of memory protection provided by memcg.
> So, let's also dump the memory protected by the memcg in such reports to
> ease the debugging.
>
> Signed-off-by: Shakeel Butt <shakeel.butt@...ux.dev>
> ---
[...]
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index c34029e92bab..623446821b00 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5636,3 +5636,16 @@ bool mem_cgroup_node_allowed(struct mem_cgroup *memcg, int nid)
> {
> return memcg ? cpuset_node_allowed(memcg->css.cgroup, nid) : true;
> }
> +
> +void mem_cgroup_show_protected_memory(struct mem_cgroup *memcg)
> +{
> + if (mem_cgroup_disabled() || !cgroup_subsys_on_dfl(memory_cgrp_subsys))
> + return;
> +
> + if (!memcg)
> + memcg = root_mem_cgroup;
> +
> + pr_warn("Memory cgroup min protection %lukB -- low protection %lukB",
> + K(atomic_long_read(&memcg->memory.children_min_usage)*PAGE_SIZE),
> + K(atomic_long_read(&memcg->memory.children_low_usage)*PAGE_SIZE));
> +}
I didn't expect this function is showing the information by calling pr_warn().
To me, "show" feels like something for file operations, like memory_min_show().
What about s/show/dump/ on the name? It makes it more consistent with the
subject of this patch, and other similar functions like dump_page() ?
No strong opinion. The current name is also ok for me, but I'm just curious your thought.
Thanks,
SJ
[...]
Powered by blists - more mailing lists