[PATCH 2/3] tools/mm/thpmaps: fix missing order-1 file THP statistics
From: Weilin Tong
Date: Tue Oct 27 2026 - 03:50:16 EST
File-backed THPs can have order 1, but the per-size counters are only
emitted for order 2 and above. Fully and contiguously mapped order-1
file THPs are therefore missing from the output.
Start emitting the per-size counters at order 1.
Fixes: 2444172cfde4 ("tools/mm: add thpmaps script to dump THP usage info")
Assisted-by: LLM
Signed-off-by: Weilin Tong <tongweilin@xxxxxxxxxxxxxxxxx>
---
tools/mm/thpmaps | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/mm/thpmaps b/tools/mm/thpmaps
index d92aace005c1..30a8e915d677 100644
--- a/tools/mm/thpmaps
+++ b/tools/mm/thpmaps
@@ -295,7 +295,7 @@ def thp_parse(vma, kpageflags, ranges, indexes, vfns, pfns, anons, heads):
def flatten_sub(type, subtype, stats):
param = f"{type}-thp-pte-{subtype}-{{}}kB"
- for od, nr in enumerate(stats[2:], 2):
+ for od, nr in enumerate(stats[1:], 1):
rstats[param.format(odkb(od))] = {'type': type, 'value': nrkb(nr)}
def flatten_type(type, stats):
--
2.43.7