Skip to content

Commit 6db12d5

Browse files
shakeelbakpm00
authored andcommitted
mm: memcg: fix unit conversion for K() macro in OOM log
The commit bc8e51c ("mm: memcg: dump memcg protection info on oom or alloc failures") added functionality to dump memcg protections on OOM or allocation failures. It uses K() macro to dump the information and passes bytes to the macro. However the macro take number of pages instead of bytes. It is defined as: #define K(x) ((x) << (PAGE_SHIFT-10)) Let's fix this. Link: https://lkml.kernel.org/r/20251216212054.484079-1-shakeel.butt@linux.dev Fixes: bc8e51c ("mm: memcg: dump memcg protection info on oom or alloc failures") Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev> Reported-by: Chris Mason <clm@fb.com> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Muchun Song <muchun.song@linux.dev> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Roman Gushchin <roman.gushchin@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent e6dbcb7 commit 6db12d5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

mm/memcontrol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5638,6 +5638,6 @@ void mem_cgroup_show_protected_memory(struct mem_cgroup *memcg)
56385638
memcg = root_mem_cgroup;
56395639

56405640
pr_warn("Memory cgroup min protection %lukB -- low protection %lukB",
5641-
K(atomic_long_read(&memcg->memory.children_min_usage)*PAGE_SIZE),
5642-
K(atomic_long_read(&memcg->memory.children_low_usage)*PAGE_SIZE));
5641+
K(atomic_long_read(&memcg->memory.children_min_usage)),
5642+
K(atomic_long_read(&memcg->memory.children_low_usage)));
56435643
}

0 commit comments

Comments
 (0)