summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauricio Faria de Oliveira <mfo@igalia.com>2025-10-01 20:56:10 +0300
committerAndrew Morton <akpm@linux-foundation.org>2025-11-17 04:27:59 +0300
commit5513cfbcf4da97ba0476d63e7670fdfcde59580f (patch)
treebd75a0ef90c3d5ed8d081bb70f980426671c96e1
parent3b52b9e31a860df97bb46e9f3bfdab9f36d5d893 (diff)
downloadlinux-5513cfbcf4da97ba0476d63e7670fdfcde59580f.tar.xz
mm/page_owner: add debugfs file 'show_stacks_handles'
Add the file 'show_stacks_handles' to show just stack traces and their handles, in order to resolve stack traces and handles (i.e., to identify the stack traces for handles in previous reads from 'show_handles'). All stacks/handles must show up, regardless of their number of pages, that might have become zero or no longer make 'count_threshold', but made it in previous reads from 'show_handles' -- and need to be resolved later. P.S.: now, print the extra newline independently of the number of pages. Link: https://lkml.kernel.org/r/20251001175611.575861-5-mfo@igalia.com Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com> Cc: Brendan Jackman <jackmanb@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Oscar Salvador <osalvador@suse.de> 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>
-rw-r--r--mm/page_owner.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mm/page_owner.c b/mm/page_owner.c
index fe788f07b578..9c67bb8fb1d9 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -916,7 +916,8 @@ static int stack_print(struct seq_file *m, void *v)
nr_base_pages = refcount_read(&stack_record->count) - 1;
- if (nr_base_pages < 1 || nr_base_pages < page_owner_pages_threshold)
+ if (ctx->flags & STACK_PRINT_FLAG_PAGES &&
+ (nr_base_pages < 1 || nr_base_pages < page_owner_pages_threshold))
return 0;
if (ctx->flags & STACK_PRINT_FLAG_STACK) {
@@ -928,7 +929,8 @@ static int stack_print(struct seq_file *m, void *v)
if (ctx->flags & STACK_PRINT_FLAG_HANDLE)
seq_printf(m, "handle: %d\n", stack_record->handle.handle);
if (ctx->flags & STACK_PRINT_FLAG_PAGES)
- seq_printf(m, "nr_base_pages: %d\n\n", nr_base_pages);
+ seq_printf(m, "nr_base_pages: %d\n", nr_base_pages);
+ seq_putc(m, '\n');
return 0;
}
@@ -1002,6 +1004,10 @@ static int __init pageowner_init(void)
(void *)(STACK_PRINT_FLAG_HANDLE |
STACK_PRINT_FLAG_PAGES),
&page_owner_stack_operations);
+ debugfs_create_file("show_stacks_handles", 0400, dir,
+ (void *)(STACK_PRINT_FLAG_STACK |
+ STACK_PRINT_FLAG_HANDLE),
+ &page_owner_stack_operations);
debugfs_create_file("count_threshold", 0600, dir, NULL,
&proc_page_owner_threshold);