linux/tools
Jiajian Ye 9c8a0a8e59 tools/vm/page_owner_sort.c: support for user-defined culling rules
When viewing page owner information, we may want to cull blocks of
information with our own rules.  So it is important to enhance culling
function to provide the support for customizing culling rules.
Therefore, following adjustments are made:

1. Add --cull option to support the culling of blocks of information
   with user-defined culling rules.

	./page_owner_sort <input> <output> --cull=<rules>
	./page_owner_sort <input> <output> --cull <rules>

  <rules> is a single argument in the form of a comma-separated list to
  specify individual culling rules, by the sequence of keys k1,k2, ....
  Mixed use of abbreviated and complete-form of keys is allowed.

  For reference, please see the document(Documentation/vm/page_owner.rst).

Now, assuming two blocks in the input file are as follows:

	Page allocated via order 0, mask xxxx, pid 1, tgid 1 (task_name_demo)
	PFN xxxx
	 prep_new_page+0xd0/0xf8
	 get_page_from_freelist+0x4a0/0x1290
	 __alloc_pages+0x168/0x340
	 alloc_pages+0xb0/0x158

	Page allocated via order 0, mask xxxx, pid 32, tgid 32 (task_name_demo)
	PFN xxxx
	 prep_new_page+0xd0/0xf8
	 get_page_from_freelist+0x4a0/0x1290
	 __alloc_pages+0x168/0x340
	 alloc_pages+0xb0/0x158

If we want to cull the blocks by stacktrace and task command name, we can
use this command:

	./page_owner_sort <input> <output> --cull=stacktrace,name

The output would be like:

	2 times, 2 pages, task_comm_name: task_name_demo
	 prep_new_page+0xd0/0xf8
	 get_page_from_freelist+0x4a0/0x1290
	 __alloc_pages+0x168/0x340
	 alloc_pages+0xb0/0x158

As we can see, these two blocks are culled successfully, for they share
the same pid and task command name.

However, if we want to cull the blocks by pid, stacktrace and task command
name, we can this command:

	./page_owner_sort <input> <output> --cull=stacktrace,name,pid

The output would be like:

	1 times, 1 pages, PID 1, task_comm_name: task_name_demo
	 prep_new_page+0xd0/0xf8
	 get_page_from_freelist+0x4a0/0x1290
	 __alloc_pages+0x168/0x340
	 alloc_pages+0xb0/0x158

	1 times, 1 pages, PID 32, task_comm_name: task_name_demo
	 prep_new_page+0xd0/0xf8
	 get_page_from_freelist+0x4a0/0x1290
	 __alloc_pages+0x168/0x340
	 alloc_pages+0xb0/0x158

As we can see, these two blocks are failed to cull, for their PIDs are
different.

2. Add explanations of --cull options to the document.

This work is coauthored by
	Yixuan Cao
	Shenghong Han
	Yinan Zhang
	Chongxi Zhao
	Yuhong Feng

Link: https://lkml.kernel.org/r/20220312145834.624-1-yejiajian2018@email.szu.edu.cn
Signed-off-by: Jiajian Ye <yejiajian2018@email.szu.edu.cn>
Cc: Yixuan Cao <caoyixuan2019@email.szu.edu.cn>
Cc: Shenghong Han <hanshenghong2019@email.szu.edu.cn>
Cc: Yinan Zhang <zhangyinan2019@email.szu.edu.cn>
Cc: Chongxi Zhao <zhaochongxi2019@email.szu.edu.cn>
Cc: Yuhong Feng <yuhongf@szu.edu.cn>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-03-24 19:06:45 -07:00
..
accounting delayacct: track delays from memory compact 2022-01-20 08:52:55 +02:00
arch ARM: 2022-03-24 11:58:57 -07:00
bootconfig
bpf bpftool: Fix a bug in subskeleton code generation 2022-03-21 14:46:10 -07:00
build Merge remote-tracking branch 'torvalds/master' into perf/core 2022-01-13 10:20:59 -03:00
cgroup tools/cgroup/slabinfo: update to work with struct slab 2022-02-21 11:34:49 +01:00
counter
debugging
edid
firewire
firmware
gpio
hv
iio iio: event_monitor: Flush output on event 2021-12-16 12:20:35 +00:00
include Merge branch 'akpm' (patches from Andrew) 2022-03-24 14:14:07 -07:00
io_uring
kvm/kvm_stat
laptop
leds
lib Networking changes for 5.18. 2022-03-24 13:13:26 -07:00
memory-model tools/memory-model: Explain syntactic and semantic dependencies 2022-02-01 17:32:30 -08:00
objtool tools/objtool: Check for use of the ENQCMD instruction in the kernel 2022-02-15 11:31:43 +01:00
pci
pcmcia
perf Networking changes for 5.18. 2022-03-24 13:13:26 -07:00
power Thermal control updates for 5.18-rc1 2022-03-21 14:35:11 -07:00
rcu
scripts tools: Fix unavoidable GCC call in Clang builds 2022-03-08 23:36:37 +01:00
spi
testing Networking changes for 5.18. 2022-03-24 13:13:26 -07:00
thermal/tmon thermal: tools: tmon: remove unneeded local variable 2021-11-24 17:26:13 +01:00
time
tracing rtla: Tools main loop cleanup 2022-03-15 14:36:50 -04:00
usb
virtio tools/virtio: handle fallout from folio work 2022-03-06 06:06:50 -05:00
vm tools/vm/page_owner_sort.c: support for user-defined culling rules 2022-03-24 19:06:45 -07:00
wmi
Makefile tools/lib/lockdep: drop liblockdep 2021-11-12 11:07:17 -08:00