malloc: Enable huge page support on main arena

System Internals / glibc - Adhemerval Zanella [linaro.org] - 15 December 2021 20:35 UTC

This patch adds support huge page support on main arena allocation, enable with tunable glibc.malloc.hugetlb=2. The patch essentially disable the __glibc_morecore() sbrk() call (similar when memory tag does when sbrk() call does not support it) and fallback to default page size if the memory allocation fails.

Checked on x86_64-linux-gnu.

0f982c1827 malloc: Enable huge page support on main arena
malloc/arena.c | 4 ++++
malloc/malloc.c | 12 ++++++++++--
malloc/morecore.c | 4 ----
3 files changed, 14 insertions(+), 6 deletions(-)

Upstream: sourceware.org


  • Share