Some applications has large code and data segment, and this causes high TLB miss when page size is 4K. Mapping these apps into hugetlbfs will boost their performance. A userspace tool libhugetlbfs can do this but it seems to stopped development since 2020, and it does not support debugging. Tmpfs supports transparent hugepage, but it will be split into small pages during copy-on-write. Userspace hotpatch will do mprotect on code segment and trigger pmd split, and some users think performance degradation after hotpatch is unacceptable. This patch set implements hugetlb support in exec, and solved the debugging issue.
--- v5: mark new Kconfigs default n and add sysctl knob v4: rebase to 5.10.0-107.0.0 v3: add MAP_FILE_HUGETLB v2: fix kabi
Liu Zixian (4): hugetlb: support private file map elf: support hugetlb map enable elf huge map by default fs: add sysctl knob for exec_hugetlb
arch/arm64/configs/openeuler_defconfig | 2 + arch/x86/configs/openeuler_defconfig | 2 + fs/Kconfig | 24 ++++++ fs/binfmt_elf.c | 115 +++++++++++++++++++++++++ fs/exec.c | 4 + fs/proc/task_mmu.c | 5 ++ include/linux/elf.h | 4 + include/linux/mm_types.h | 4 + include/uapi/asm-generic/mman-common.h | 1 + include/uapi/linux/elf.h | 1 + kernel/events/core.c | 7 ++ kernel/fork.c | 5 ++ kernel/sysctl.c | 11 +++ mm/hugetlb.c | 25 ++++++ mm/mmap.c | 20 +++++ mm/util.c | 40 +++++++++ 16 files changed, 270 insertions(+)