[PATCH v1 5/5] tools/mm/page-types.c: hide compound pages in non-raw mode

From: Naoya Horiguchi
Date: Tue Oct 10 2023 - 10:29:13 EST


From: Naoya Horiguchi <naoya.horiguchi@xxxxxxx>

In non-raw mode (i.e. calling page-types without -r flag), any flags
for compound pages except for hugetlb are supposed to be hidden.
But currently KPF_THP is shown and the newly added flag KPF_FOLIO is
also shown, which is unexpected. So hide them.

Signed-off-by: Naoya Horiguchi <naoya.horiguchi@xxxxxxx>
---
tools/mm/page-types.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c
index b78448d19e88..c37e1e79bc61 100644
--- a/tools/mm/page-types.c
+++ b/tools/mm/page-types.c
@@ -508,7 +508,7 @@ static uint64_t well_known_flags(uint64_t flags)

/* hide non-hugeTLB compound pages */
if ((flags & BITS_COMPOUND) && !(flags & BIT(HUGE)))
- flags &= ~BITS_COMPOUND;
+ flags &= ~(BITS_COMPOUND|BIT(THP)|BIT(FOLIO));

return flags;
}
--
2.25.1