From 2ace2eddbd6a0cda2006e632444cd19a360d12d4 Mon Sep 17 00:00:00 2001 From: Lv Ying Date: Fri, 24 Feb 2023 16:14:42 +0800 Subject: [PATCH 2/3] elf/ld.so: keep compatible with the original policy of the LD_HUGEPAGE_LIB env When we use new policy: ld.so load PT_LOAD segement use hugepage according to PF_HUGEPAGE flag. We should keep compatible with the original policy of the LD_HUGEPAGE_LIB env which loads all the PT_LOAD segment try to use hugepage. Signed-off-by: Lv Ying --- elf/dl-load.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elf/dl-load.c b/elf/dl-load.c index e0d4fa2e..e01bb448 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1184,7 +1184,9 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, } #ifdef HUGEPAGE_SHARED_LIB - if (ph->p_flags & PF_HUGEPAGE) { + if (GLRO(dl_hugepage_mask) & DL_HUGEPAGE_LIB_LARGE_IN_FLAG) { + hp_bitmap[nloadcmds] = 1; + } else if (ph->p_flags & PF_HUGEPAGE) { hp_bitmap[nloadcmds] = 1; use_hugepage = true; } else -- 2.38.1