[PATCH v8 6/6] loongarch: Enable THP-aligned load segments by default on 64-bit

Wilco Dijkstra Wilco.Dijkstra@arm.com
Sun Apr 12 14:13:37 GMT 2026


Hi HJ,

> glibc shouldn't assume THP status which is set by kernel.

We cannot safely get the THP status using the /sys/kernel/mm interface:

commit 2e8a940df14e9e03fd5bd01015ebbd00c1a5e9b4
Author: Wilco Dijkstra <wilco.dijkstra@arm.com>
Date:   Fri Feb 27 20:20:45 2026 +0000

    malloc: Avoid accessing /sys/kernel/mm files

    On AArch64 malloc always checks /sys/kernel/mm/transparent_hugepage/enabled to
    set the THP mode.  However this check is quite expensive and the file may not
    be accessible in containers. If DEFAULT_THP_PAGESIZE is non-zero, use
    malloc_thp_mode_madvise so that we take advantage of THP in all cases.  Since
    madvise is a fast systemcall, it adds only a small overhead compared to the
    cost of mmap and populating the pages.

    Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

Cheers,
Wilco


More information about the Libc-alpha mailing list