
The GNU C Library has landed huge pages support on Linux for mmap and arenas code that can be enabled with a new glibc tunable. That same tunable also allows enabling madvise support for transparent huge pages (THP).
The code merged this afternoon to Glibc Git across multiple commits explains:
On Linux, a new tunable, glibc.malloc.hugetlb, can be used to either make malloc issue madvise plus MADV_HUGEPAGE on mmap and sbrk or to use huge pages directly with mmap calls with the MAP_HUGETLB flags). The former can improve performance when Transparent Huge Pages is set to 'madvise' mode while the latter uses the system reserved huge pages.
This madvise/THP work for Glibc was written by Linaro's Adhemerval Zanella. More details for those interested in these latest commits .
This better handling of Linux THP will be found in Glibc 2.35 due out in February along with plenty of other improvements to this common Linux C library implementation.