Re: [PATCH 2/3] tools/mm/thpmaps: fix missing order-1 file THP statistics
From: David Hildenbrand (Arm)
Date: Mon Nov 02 2026 - 08:00:10 EST
On 10/27/26 08:49, Weilin Tong wrote:
> 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):
Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
--
Cheers,
David