Skip to content

Commit 5b94ce2

Browse files
iehlog0zbtorvalds
authored andcommitted
tools/vm/page_owner_sort.c: filter out unneeded line
To see a sorted result from page_owner, there must be a tiresome preprocessing step before running page_owner_sort. This patch simply filters out lines which start with "PFN" while reading the page owner report. Signed-off-by: Changhee Han <ch0.han@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Jonathan Corbet <corbet@lwn.net> Link: http://lkml.kernel.org/r/20200429052940.16968-1-ch0.han@lge.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 21e330f commit 5b94ce2

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎Documentation/vm/page_owner.rst‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ Usage
8383
4) Analyze information from page owner::
8484

8585
cat /sys/kernel/debug/page_owner > page_owner_full.txt
86-
grep -v ^PFN page_owner_full.txt > page_owner.txt
87-
./page_owner_sort page_owner.txt sorted_page_owner.txt
86+
./page_owner_sort page_owner_full.txt sorted_page_owner.txt
8887

8988
See the result about who allocated each page
9089
in the ``sorted_page_owner.txt``.

‎tools/vm/page_owner_sort.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
*
55
* Example use:
66
* cat /sys/kernel/debug/page_owner > page_owner_full.txt
7-
* grep -v ^PFN page_owner_full.txt > page_owner.txt
8-
* ./page_owner_sort page_owner.txt sorted_page_owner.txt
7+
* ./page_owner_sort page_owner_full.txt sorted_page_owner.txt
98
*
109
* See Documentation/vm/page_owner.rst
1110
*/
@@ -38,6 +37,8 @@ int read_block(char *buf, int buf_size, FILE *fin)
3837
while (buf_end - curr > 1 && fgets(curr, buf_end - curr, fin)) {
3938
if (*curr == '\n') /* empty line */
4039
return curr - buf;
40+
if (!strncmp(curr, "PFN", 3))
41+
continue;
4142
curr += strlen(curr);
4243
}
4344

0 commit comments

Comments
 (0)