From: Changhee Han Date: Wed, 3 Jun 2020 23:03:22 +0000 (-0700) Subject: tools/vm/page_owner_sort.c: filter out unneeded line X-Git-Tag: v5.10.7~2467^2~12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b94ce2fcae2542c4d5d49176fa23eea638dc7b6;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: Andrew Morton Reviewed-by: Andrew Morton Cc: Vlastimil Babka Cc: Joonsoo Kim Cc: Jonathan Corbet Link: http://lkml.kernel.org/r/20200429052940.16968-1-ch0.han@lge.com Signed-off-by: Linus Torvalds --- diff --git a/Documentation/vm/page_owner.rst b/Documentation/vm/page_owner.rst index 0ed5ab8..079f3f8 100644 --- a/Documentation/vm/page_owner.rst +++ b/Documentation/vm/page_owner.rst @@ -83,8 +83,7 @@ Usage 4) Analyze information from page owner:: 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.txt sorted_page_owner.txt + ./page_owner_sort page_owner_full.txt sorted_page_owner.txt See the result about who allocated each page in the ``sorted_page_owner.txt``. diff --git a/tools/vm/page_owner_sort.c b/tools/vm/page_owner_sort.c index d3a8755..85eb65e 100644 --- a/tools/vm/page_owner_sort.c +++ b/tools/vm/page_owner_sort.c @@ -4,8 +4,7 @@ * * Example use: * 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.txt sorted_page_owner.txt + * ./page_owner_sort page_owner_full.txt sorted_page_owner.txt * * See Documentation/vm/page_owner.rst */ @@ -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)) { if (*curr == '\n') /* empty line */ return curr - buf; + if (!strncmp(curr, "PFN", 3)) + continue; curr += strlen(curr); }