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

Message ID 20231010142801.3780917-6-naoya.horiguchi@linux.dev
State New
Headers
Series mm, kpageflags: support folio and fix output for compound pages |

Commit Message

Naoya Horiguchi Oct. 10, 2023, 2:28 p.m. UTC
  From: Naoya Horiguchi <naoya.horiguchi@nec.com>

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@nec.com>
---
 tools/mm/page-types.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

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;
 }