<Post

AMD proposes an LLVM flag to promote executable text to huge pages

An opt-in -fenable-readonly-thp Clang feature would align ELF segments at 2 MiB boundaries, then call madvise(MADV_COLLAPSE) so Linux can map large executable .text regions with instruction THP. The proposal targets iTLB pressure in large interpreters, servers, and compiler-like binaries without BOLT’s profiling pass; it trades some padding and startup work for simpler deployment. Linux 6.1+ supports tmpfs-backed binaries, while Linux 7.2+ adds disk-backed files with CONFIG_READ_ONLY_THP_FOR_FS.

The LLVM discussion includes a useful design objection: Google already uses a separate startup library and questions putting this in Clang rather than libc. Phoronix’s two-comment forum thread was inaccessible here.