On Mon, 12 Feb 2024 at 23:29, Oscar Salvador <osalvador@xxxxxxx> wrote: > > Update page_owner documentation including the new page_owner_stacks > feature to show how it can be used. > > Signed-off-by: Oscar Salvador <osalvador@xxxxxxx> > --- > Documentation/mm/page_owner.rst | 44 +++++++++++++++++++++++++++++++++ > 1 file changed, 44 insertions(+) > > diff --git a/Documentation/mm/page_owner.rst b/Documentation/mm/page_owner.rst > index 62e3f7ab23cc..bcde81bf0902 100644 > --- a/Documentation/mm/page_owner.rst > +++ b/Documentation/mm/page_owner.rst > @@ -24,6 +24,11 @@ fragmentation statistics can be obtained through gfp flag information of > each page. It is already implemented and activated if page owner is > enabled. Other usages are more than welcome. > > +It can also be used to show all the stacks and their outstanding > +allocations, which gives us a quick overview of where the memory is going > +without the need to screen through all the pages and match the allocation > +and free operation. > + > page owner is disabled by default. So, if you'd like to use it, you need > to add "page_owner=on" to your boot cmdline. If the kernel is built > with page owner and page owner is disabled in runtime due to not enabling > @@ -68,6 +73,45 @@ Usage > > 4) Analyze information from page owner:: > > + cat /sys/kernel/debug/page_owner_stacks/show_stacks > stacks.txt > + cat stacks.txt > + prep_new_page+0xa9/0x120 > + get_page_from_freelist+0x7e6/0x2140 > + __alloc_pages+0x18a/0x370 > + new_slab+0xc8/0x580 > + ___slab_alloc+0x1f2/0xaf0 > + __slab_alloc.isra.86+0x22/0x40 > + kmem_cache_alloc+0x31b/0x350 > + __khugepaged_enter+0x39/0x100 > + dup_mmap+0x1c7/0x5ce > + copy_process+0x1afe/0x1c90 > + kernel_clone+0x9a/0x3c0 > + __do_sys_clone+0x66/0x90 > + do_syscall_64+0x7f/0x160 > + entry_SYSCALL_64_after_hwframe+0x6c/0x74 > + stack_count: 234 > + ... > + ... > + echo 7000 > /sys/kernel/debug/page_owner_stacks/set_threshold > stacks_7000.txt I think this example command is wrong.