Linux_Huge_Pages.svg

For configuration see this article, my sytemd unit and transparent huge pages doc

Memory mapping with mmap

private/shared file/anon Huge allowed Description
private anon OK forked process will have the mmap region but will NOT see writes from parent
private memfd OK same as above
private file NO write to memory will NOT be persisted to the file
shared anon OK forked process will have the mmap region but will see writes from parent
shared file NO write to memory will eventually be persisted to file

Huge page memory inspection

# Stats on transparent huge pages
grep thp /proc/vmstat
# Stats on pre-allocated huge pages
grep -i huge /proc/meminfo
# Mounted hugetlbfs
mount | grep huge
# THP parameters
cat /sys/kernel/mm/transparent_hugepage/*/* /sys/kernel/mm/transparent_hugepage/*

FAQ