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_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>

authored by

Mauricio Faria de Oliveira and committed by
Andrew Morton
5513cfbc 3b52b9e3

+8 -2
+8 -2
mm/page_owner.c
··· 916 916 917 917 nr_base_pages = refcount_read(&stack_record->count) - 1; 918 918 919 - if (nr_base_pages < 1 || nr_base_pages < page_owner_pages_threshold) 919 + if (ctx->flags & STACK_PRINT_FLAG_PAGES && 920 + (nr_base_pages < 1 || nr_base_pages < page_owner_pages_threshold)) 920 921 return 0; 921 922 922 923 if (ctx->flags & STACK_PRINT_FLAG_STACK) { ··· 929 928 if (ctx->flags & STACK_PRINT_FLAG_HANDLE) 930 929 seq_printf(m, "handle: %d\n", stack_record->handle.handle); 931 930 if (ctx->flags & STACK_PRINT_FLAG_PAGES) 932 - seq_printf(m, "nr_base_pages: %d\n\n", nr_base_pages); 931 + seq_printf(m, "nr_base_pages: %d\n", nr_base_pages); 932 + seq_putc(m, '\n'); 933 933 934 934 return 0; 935 935 } ··· 1003 1001 debugfs_create_file("show_handles", 0400, dir, 1004 1002 (void *)(STACK_PRINT_FLAG_HANDLE | 1005 1003 STACK_PRINT_FLAG_PAGES), 1004 + &page_owner_stack_operations); 1005 + debugfs_create_file("show_stacks_handles", 0400, dir, 1006 + (void *)(STACK_PRINT_FLAG_STACK | 1007 + STACK_PRINT_FLAG_HANDLE), 1006 1008 &page_owner_stack_operations); 1007 1009 debugfs_create_file("count_threshold", 0600, dir, NULL, 1008 1010 &proc_page_owner_threshold);