Isn't `madvise` useful if you want to use Huge Pages?
If you're hoping file-backed mmaps from any filesystem other than tmpfs/shmem will use huge pages, you will be disappointed. :-( See the following note at https://www.kernel.org/doc/html/latest/admin-guide/mm/transh... > Currently THP only works for anonymous memory mappings and tmpfs/shmem.
$ cat /proc//smaps
[...]
7efca62e3000-7efcaa13d000 r-xp 00ae3000 00:18 75354786 /usr/lib/libLLVM-15.so
Size: 63848 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Rss: 58420 kB
Pss: 19213 kB
Pss_Dirty: 0 kB
Shared_Clean: 56372 kB
Shared_Dirty: 0 kB
Private_Clean: 2048 kB
Private_Dirty: 0 kB
Referenced: 58420 kB
Anonymous: 0 kB
LazyFree: 0 kB
AnonHugePages: 0 kB
ShmemPmdMapped: 0 kB
FilePmdMapped: 57344 kB