tools/vm/page_owner_sort.c: sort by stacktrace before culling
authorSean Anderson <seanga2@gmail.com>
Thu, 30 Dec 2021 09:28:20 +0000 (20:28 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sun, 16 Jan 2022 07:27:01 +0000 (18:27 +1100)
commit014e133a8046e0ed41893f58941be00ae4db6dcd
treeb2e281d063cba50cacab93b3ec1b9bab93500ecb
parent53eec3fb230d36376c8b25874b0ae8c0ec75d97c
tools/vm/page_owner_sort.c: sort by stacktrace before culling

The contents of page_owner have changed to include more information than
the stack trace.  On a modern kernel, the blocks look like

Page allocated via order 0, mask 0x0(), pid 1, ts 165564237 ns, free_ts 0 ns
 register_early_stack+0x4b/0x90
 init_page_owner+0x39/0x250
 kernel_init_freeable+0x11e/0x242
 kernel_init+0x16/0x130

Sorting by the contents of .txt will result in almost no repeated pages,
as the pid, ts, and free_ts will almost never be the same.  Instead, sort
by the contents of the stack trace, which we assume to be whatever is
after the first line.

Link: https://lkml.kernel.org/r/20211124193709.1805776-1-seanga2@gmail.com
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Cc: Changhee Han <ch0.han@lge.com>
Cc: Tang Bin <tangbin@cmss.chinamobile.com>
Cc: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Cc: Zhenliang Wei <weizhenliang@huawei.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Yinan Zhang <zhangyinan2019@email.szu.edu.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
tools/vm/page_owner_sort.c