Commit 5b94ce2f authored by Changhee Han's avatar Changhee Han Committed by Linus Torvalds

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: default avatarChanghee Han <ch0.han@lge.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Reviewed-by: default avatarAndrew 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.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 21e330fc
...@@ -83,8 +83,7 @@ Usage ...@@ -83,8 +83,7 @@ Usage
4) Analyze information from page owner:: 4) Analyze information from page owner::
cat /sys/kernel/debug/page_owner > page_owner_full.txt cat /sys/kernel/debug/page_owner > page_owner_full.txt
grep -v ^PFN page_owner_full.txt > page_owner.txt ./page_owner_sort page_owner_full.txt sorted_page_owner.txt
./page_owner_sort page_owner.txt sorted_page_owner.txt
See the result about who allocated each page See the result about who allocated each page
in the ``sorted_page_owner.txt``. in the ``sorted_page_owner.txt``.
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
* *
* Example use: * Example use:
* cat /sys/kernel/debug/page_owner > page_owner_full.txt * cat /sys/kernel/debug/page_owner > page_owner_full.txt
* grep -v ^PFN page_owner_full.txt > page_owner.txt * ./page_owner_sort page_owner_full.txt sorted_page_owner.txt
* ./page_owner_sort page_owner.txt sorted_page_owner.txt
* *
* See Documentation/vm/page_owner.rst * See Documentation/vm/page_owner.rst
*/ */
...@@ -38,6 +37,8 @@ int read_block(char *buf, int buf_size, FILE *fin) ...@@ -38,6 +37,8 @@ int read_block(char *buf, int buf_size, FILE *fin)
while (buf_end - curr > 1 && fgets(curr, buf_end - curr, fin)) { while (buf_end - curr > 1 && fgets(curr, buf_end - curr, fin)) {
if (*curr == '\n') /* empty line */ if (*curr == '\n') /* empty line */
return curr - buf; return curr - buf;
if (!strncmp(curr, "PFN", 3))
continue;
curr += strlen(curr); curr += strlen(curr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment