[PATCH v2] malloc: Enable 2MB THP by default on Aarch64

Wilco Dijkstra Wilco.Dijkstra@arm.com
Wed Dec 10 12:50:34 GMT 2025


Hi Dev,

> Linux supports multi-sized Transparent Huge Pages (mTHP). For the purpose
> of this patch description, we call the block size mapped by a non-last
> level pagetable level, the traditional THP size (2M for 4K basepage,
> 512M for 64K basepage). Linux now also supports intermediate THP sizes
> mapped by the last level pagetable - we call that the mTHP size.
>
> The support for mTHP in Linux has grown to be better and stable over time -
> applications can benefit from reduced page faults and reduced kernel
> memory management overhead, albeit at the cost of internal fragmentation.
> We have observed consistent performance boosts with mTHP with little
> variance.
>
> As a result, enable 2M THP by default on Aarch64. This enables THP even if
> user hasn't passed glibc.malloc.hugetlb=1. If user has passed it, we avoid
> making the system call to check the hugepage size from sysfs, and override
> it with the hardcoded 2MB.

Looks good now, and it's a great speedup! I've committed it now.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>

Cheers,
Wilco


More information about the Libc-alpha mailing list