Lazy allocation#
make large_mmap
./large_mmapMonitor memory usage:
watch -n 0.2 'ps -o pid,vsz,rss,comm -p $(pidof large_mmap)'Monitor page fault events:
sudo perf stat -p $(pidof large_mmap) -e page-faults -I 1000Observe perf counter going up with each page fault and RSS growing.
Follow-up: allow huge page mapping.
PF cost#
make pf_costRun few times:
./pf_costObserve large timing discrepancy between 1st and 2nd passes. Follow-up: allow huge page mapping.
Memory overcommit#
Inspect current memory state:
LANG=en watch -n0.2 free -hDisable swap if you have one:
sudo swapoff -aThen try to allocate something:
make alloc./alloc 100Obviously large overallocations are disallowed.
Try however to allocate slightly more than available:
./alloc 30Inspect OOM killer events:
journalctl -k | grep -i "Out of memory"