[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1756318426.git.pyyjason@gmail.com>
Date: Wed, 27 Aug 2025 11:34:21 -0700
From: Yueyang Pan <pyyjason@...il.com>
To: Suren Baghdasaryan <surenb@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Michal Hocko <mhocko@...e.com>,
Brendan Jackman <jackmanb@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Zi Yan <ziy@...dia.com>,
Usama Arif <usamaarif642@...il.com>
Cc: linux-mm@...ck.org,
kernel-team@...a.com,
linux-kernel@...r.kernel.org
Subject: [PATCH v1 0/2] mm/show_mem: Bug fix for print mem alloc info
This patch set fixes two issues we saw in production rollout.
The first issue is that we saw all zero output of memory allocation
profiling information from show_mem() if CONFIG_MEM_ALLOC_PROFILING
is set and sysctl.vm.mem_profiling=0. In this case, the behaviour
should be the same as when CONFIG_MEM_ALLOC_PROFILING is unset,
where show_mem prints nothing about the information. This will make
further parse easier as we don't have to differentiate what a all
zero line actually means (Does it mean 0 bytes are allocated
or simply memory allocation profiling is disabled).
The second issue is that multiple entities can call show_mem()
which messed up the allocation info in dmesg. We saw outputs like this:
```
327 MiB 83635 mm/compaction.c:1880 func:compaction_alloc
48.4 GiB 12684937 mm/memory.c:1061 func:folio_prealloc
7.48 GiB 10899 mm/huge_memory.c:1159 func:vma_alloc_anon_folio_pmd
298 MiB 95216 kernel/fork.c:318 func:alloc_thread_stack_node
250 MiB 63901 mm/zsmalloc.c:987 func:alloc_zspage
1.42 GiB 372527 mm/memory.c:1063 func:folio_prealloc
1.17 GiB 95693 mm/slub.c:2424 func:alloc_slab_page
651 MiB 166732 mm/readahead.c:270 func:page_cache_ra_unbounded
419 MiB 107261 net/core/page_pool.c:572 func:__page_pool_alloc_pages_slow
404 MiB 103425 arch/x86/mm/pgtable.c:25 func:pte_alloc_one
```
The above example is because one kthread invokes show_mem()
from __alloc_pages_slowpath while kernel itself calls
oom_kill_process()
Yueyang Pan (2):
mm/show_mem: No print when not mem_alloc_profiling_enabled()
mm/show_mem: Add trylock while printing alloc info
mm/show_mem.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--
2.47.3
Powered by blists - more mailing lists