The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] tools/mm/page_owner_sort: fix slab allocator labelling
@ 2026-11-17 21:49 Yifan Feng
  0 siblings, 0 replies; only message in thread
From: Yifan Feng @ 2026-11-17 21:49 UTC (permalink / raw)
  To: Andrew Morton, Vlastimil Babka
  Cc: David Hildenbrand, Johannes Weiner, Suren Baghdasaryan,
	Michal Hocko, Brendan Jackman, Zi Yan, Lorenzo Stoakes,
	Liam R. Howlett, Mike Rapoport, Matthew Wilcox (Oracle), linux-mm,
	linux-kernel, Yifan Feng

page_owner_sort labels a page as allocated by slab when the page flags
in the "PFN" line contain "slab". Since commit 46df8e73a4a3 ("mm: free
up PG_slab") slab is a page type and is not printed there any more, so
slab pages are reported as allocated by OTHERS.

Also look for the slab page allocation in the stack trace, as is done
for vmalloc. The frame is new_slab(), or allocate_slab() when new_slab()
is inlined, as in the example in Documentation/mm/page_owner.rst. Slab
pages allocated before page_owner is initialised have no stack trace
and are still not labelled.

Fixes: 46df8e73a4a3 ("mm: free up PG_slab")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
---
Tested on v7.4-rc3 in QEMU: --cull=ator finds 1280 SLAB records, 0 before.
Found and written with the help of an AI coding assistant.

 tools/mm/page_owner_sort.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/mm/page_owner_sort.c b/tools/mm/page_owner_sort.c
index 6c2ac5d9dc4b..453da5ba85c5 100644
--- a/tools/mm/page_owner_sort.c
+++ b/tools/mm/page_owner_sort.c
@@ -489,7 +489,8 @@ static int get_allocator(const char *buf, const char *migrate_info)
 
 	if (strstr(migrate_info, "CMA"))
 		allocator |= ALLOCATOR_CMA;
-	if (strstr(migrate_info, "slab"))
+	if (strstr(migrate_info, "slab") || strstr(buf, "new_slab") ||
+	    strstr(buf, "allocate_slab"))
 		allocator |= ALLOCATOR_SLAB;
 	tmp = strstr(buf, "__vmalloc_node_range");
 	if (tmp) {

base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-17 21:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 21:49 [PATCH] tools/mm/page_owner_sort: fix slab allocator labelling Yifan Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox