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

Wilco Dijkstra Wilco.Dijkstra@arm.com
Wed Nov 26 14:02:15 GMT 2025


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).

Cheers,
Wilco


More information about the Libc-alpha mailing list