[PATCH v5 6/6] loongarch: Enable THP-aligned load segments by default on 64-bit
Xi Ruoyao
xry111@xry111.site
Sun Mar 8 09:44:15 GMT 2026
On Fri, 2026-03-06 at 21:48 +0800, WANG Rui wrote:
> On LoongArch64 Linux, aligning ELF load segments to Transparent Huge Page
> (THP) boundaries provides consistent performance benefits for large
> binaries by reducing TLB pressure and improving instruction fetch
> efficiency.
>
> Enable THP-based load segment alignment by default on LoongArch64 by
> setting `glibc.elf.hugetlb=1` during startup. Define the default THP
> page size for load segment alignment on LoongArch64 as 32MB.
>
> This allows the dynamic loader to apply THP-friendly alignment without
> requiring the `glibc.elf.hugetlb` tunable to be explicitly set.
>
> * sysdeps/unix/sysv/linux/loongarch/cpu-features.c
> (init_cpu_features): Set glibc.elf.hugetlb to 1 by default on LoongArch64.
> * sysdeps/unix/sysv/linux/loongarch/lp64/dl-map-segment-align.h:
> Define DL_MAP_DEFAULT_THP_PAGESIZE as 32MB.
>
> Signed-off-by: WANG Rui <wangrui@loongson.cn>
I suggest to translate the experiment results at
https://github.com/loongson-community/discussions/issues/115 into
English and include it in the commit message here.
--
Xi Ruoyao <xry111@xry111.site>
More information about the Libc-alpha
mailing list