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

Dev Jain dev.jain@arm.com
Thu Nov 27 04:47:48 GMT 2025


On 26/11/25 7:32 pm, Wilco Dijkstra wrote:
> Hi Dev,
>
> So before we call madvice_thp for the first time, we have this code:
>
>        if (__glibc_unlikely (mp_.thp_pagesize != 0))
>          {
>            uintptr_t lastbrk = (uintptr_t) MORECORE (0);
>            uintptr_t top = ALIGN_UP (lastbrk + size, mp_.thp_pagesize);
>            size = top - lastbrk;
>          }
>
> It seems to me we should call thp_init() before this so that thp_pagesize
> is set correctly and we align to a huge page if needed (rather than wait
> for the next allocation).

You are right, that makes the code more deterministic, thanks.

>
> Cheers,
> Wilco


More information about the Libc-alpha mailing list