All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/mm/page_owner_sort: fix slab allocator labelling
@ 2026-11-17 21:49 Yifan Feng
  2026-11-25  2:11 ` + tools-mm-page_owner_sort-fix-slab-allocator-labelling.patch added to mm-new branch Andrew Morton
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* + tools-mm-page_owner_sort-fix-slab-allocator-labelling.patch added to mm-new branch
  2026-11-17 21:49 [PATCH] tools/mm/page_owner_sort: fix slab allocator labelling Yifan Feng
@ 2026-11-25  2:11 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-11-25  2:11 UTC (permalink / raw)
  To: mm-commits, ziy, willy, vbabka, surenb, rppt, mhocko, ljs, liam,
	hannes, david, brendan.jackman, evanfengff, akpm


The patch titled
     Subject: tools/mm/page_owner_sort: fix slab allocator labelling
has been added to the -mm mm-new branch.  Its filename is
     tools-mm-page_owner_sort-fix-slab-allocator-labelling.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/tools-mm-page_owner_sort-fix-slab-allocator-labelling.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

The mm-new branch of mm.git is not included in linux-next

If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Yifan Feng <evanfengff@gmail.com>
Subject: tools/mm/page_owner_sort: fix slab allocator labelling
Date: Tue, 17 Nov 2026 13:49:47 -0800

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.

Link: https://patch.msgid.link/20261117214947.13471-1-evanfengff@gmail.com
Fixes: 46df8e73a4a3 ("mm: free up PG_slab")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Brendan Jackman <brendan.jackman@linux.dev>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>

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

--- a/tools/mm/page_owner_sort.c~tools-mm-page_owner_sort-fix-slab-allocator-labelling
+++ a/tools/mm/page_owner_sort.c
@@ -489,7 +489,8 @@ static int get_allocator(const char *buf
 
 	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) {
_

Patches currently in -mm which might be from evanfengff@gmail.com are

mm-damon-core-fix-damos_walk-hang-with-zero-watermarks-interval.patch
mm-damon-core-do-not-overwrite-wmarksactivated-in-damos_commit.patch
tools-mm-page_owner_sort-fix-slab-allocator-labelling.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-25  2:11 UTC | newest]

Thread overview: 2+ messages (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
2026-11-25  2:11 ` + tools-mm-page_owner_sort-fix-slab-allocator-labelling.patch added to mm-new branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.