Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/page_owner: add debugfs file 'show_handles'

Add the flag STACK_PRINT_FLAG_HANDLE to print a stack's handle number from
stackdepot, and add the file 'show_handles' to show just handles and their
number of pages.

This is similar to 'show_stacks', with handles instead of stack traces.

Link: https://lkml.kernel.org/r/20251001175611.575861-4-mfo@igalia.com
Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
Reviewed-by: Oscar Salvador <osalvador@suse.de>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Mauricio Faria de Oliveira and committed by
Andrew Morton
3b52b9e3 5c8ca473

+7
+7
mm/page_owner.c
··· 47 47 48 48 #define STACK_PRINT_FLAG_STACK 0x1 49 49 #define STACK_PRINT_FLAG_PAGES 0x2 50 + #define STACK_PRINT_FLAG_HANDLE 0x4 50 51 51 52 struct stack_print_ctx { 52 53 struct stack *stack; ··· 925 924 for (i = 0; i < nr_entries; i++) 926 925 seq_printf(m, " %pS\n", (void *)entries[i]); 927 926 } 927 + if (ctx->flags & STACK_PRINT_FLAG_HANDLE) 928 + seq_printf(m, "handle: %d\n", stack_record->handle.handle); 928 929 if (ctx->flags & STACK_PRINT_FLAG_PAGES) 929 930 seq_printf(m, "nr_base_pages: %d\n\n", nr_base_pages); 930 931 ··· 996 993 dir = debugfs_create_dir("page_owner_stacks", NULL); 997 994 debugfs_create_file("show_stacks", 0400, dir, 998 995 (void *)(STACK_PRINT_FLAG_STACK | 996 + STACK_PRINT_FLAG_PAGES), 997 + &page_owner_stack_operations); 998 + debugfs_create_file("show_handles", 0400, dir, 999 + (void *)(STACK_PRINT_FLAG_HANDLE | 999 1000 STACK_PRINT_FLAG_PAGES), 1000 1001 &page_owner_stack_operations); 1001 1002 debugfs_create_file("count_threshold", 0600, dir, NULL,