[PATCH] tools/vm/page_owner: filter out pid and timestamp

From: Muchun Song
Date: Tue Feb 15 2022 - 08:41:00 EST


Commit 9cc7e96aa846 ("mm/page_owner: record timestamp and pid") introduces
timestamp and pid for page owner. However, it is hard to aggregate the
stack since those are specific (especially timestamp). Filter out those
information when aggregating.

Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
---
tools/vm/page_owner_sort.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/vm/page_owner_sort.c b/tools/vm/page_owner_sort.c
index 9ebb84a9c731..fc231749e0a9 100644
--- a/tools/vm/page_owner_sort.c
+++ b/tools/vm/page_owner_sort.c
@@ -45,6 +45,12 @@ int read_block(char *buf, int buf_size, FILE *fin)
return curr - buf;
if (!strncmp(curr, "PFN", 3))
continue;
+ if (!strncmp(curr, "Page allocated via order", 24)) {
+ char *end = strstr(curr, ", pid ");
+
+ if (end)
+ memcpy(end, "\n", 2);
+ }
curr += strlen(curr);
}

--
2.11.0