diff options
author | Oscar Salvador <osalvador@suse.de> | 2023-05-16 20:25:36 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-05-16 16:30:38 -0700 |
commit | e435b85a4aea7a82259105d5d8025655460052e1 (patch) | |
tree | b39f8e3a8eb7635b3fa4a39f6dc623314ec4cba4 /mm | |
parent | 03163d2a1d43d302191d3185053f0b6646b9d686 (diff) | |
download | linux-next-e435b85a4aea7a82259105d5d8025655460052e1.tar.gz |
mm, page_owner: add page_owner_stacks file to print out only stacks and their counte
We might be only interested in knowing about stacks <-> count
relationship, so instead of having to fiddle with page_owner output and
screen through pfns, let us add a new file called 'page_owner_stacks' that
does just that. By cating such file, we will get all the stacktraces
followed by its counter, so we can have a more global view.
Link: https://lkml.kernel.org/r/20230516182537.3139-3-osalvador@suse.de
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Waiman Long <longman@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_owner.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mm/page_owner.c b/mm/page_owner.c index 2d5d07013e4e..2d97f6b34ea6 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -719,6 +719,30 @@ static const struct file_operations proc_page_owner_operations = { .llseek = lseek_page_owner, }; +static void stack_stop(struct seq_file *m, void *v) +{ +} + +static const struct seq_operations page_owner_stack_op = { + .start = stack_start, + .next = stack_next, + .stop = stack_stop, + .show = stack_print +}; + +static int page_owner_stack_open(struct inode *inode, struct file *file) +{ + return seq_open_private(file, &page_owner_stack_op, + sizeof(unsigned long)); +} + +const struct file_operations page_owner_stack_operations = { + .open = page_owner_stack_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; + static int __init pageowner_init(void) { if (!static_branch_unlikely(&page_owner_inited)) { @@ -729,6 +753,9 @@ static int __init pageowner_init(void) debugfs_create_file("page_owner", 0400, NULL, NULL, &proc_page_owner_operations); + debugfs_create_file("page_owner_stacks", 0400, NULL, NULL, + &page_owner_stack_operations); + return 0; } late_initcall(pageowner_init) |