$ ../tools/pin.sh -q perf stat -e dTLB-load-misses:u,dTLB-loads:u ./bin/06_tlb_hugepages 4k
mode=4k region=1024 MB huge after fault=0 MB, after MADV_COLLAPSE=0 MB (rc=0 ok) | dependent random loads: 226.3 ns/load
4,967,751 cpu_core/dTLB-load-misses/ # 92.89% of all dTLB cache accesses
5,347,937 cpu_core/dTLB-loads/$ ../tools/pin.sh -q perf stat -e dTLB-load-misses:u,dTLB-loads:u ./bin/06_tlb_hugepages huge
mode=huge region=1024 MB huge after fault=324 MB, after MADV_COLLAPSE=324 MB (rc=12 Cannot allocate memory) | dependent random loads: 188.9 ns/load
3,417,438 cpu_core/dTLB-load-misses/ # 64.90% of all dTLB cache accesses
5,265,403 cpu_core/dTLB-loads/Read it: with 4 KiB pages 93% of the 5M dependent loads miss the TLB (each is a fresh random page). Asking for huge pages got only 324 MB of the 1 GiB as huge pages, and MADV_COLLAPSE could not finish the job (ENOMEM: the kernel has no free 2 MiB-contiguous physical chunks on this busy laptop). Result: a third of the loads hit huge pages, misses drop to 65%, time drops 226 -> 189 ns. Partial success, honestly reported by the program itself: NEVER assume you got huge pages; measure AnonHugePages (/proc/self/smaps) and the miss rate.