The "too small to fail" memory-allocation rule
The "too small to fail" memory-allocation rule
Posted Apr 18, 2019 6:36 UTC (Thu) by thestinger (guest, #91827)In reply to: The "too small to fail" memory-allocation rule by quotemstr
Parent article: The "too small to fail" memory-allocation rule
The linux-man-pages project is not the official kernel documentation and has often been inaccurate about important things for many years. MAP_NORESERVE doesn't work as it describes at all.
It has no impact in the full overcommit mode or the memory accounting mode, which makes sense. It only has an impact in the heuristic overcommit mode, where it disables the heuristic for causing immediate failure.
Note how a read-only (or PROT_NONE) mapping with not data has no accounting cost:
For an anonymous or /dev/zero map
SHARED - size of mapping
PRIVATE READ-only - 0 cost (but of little use)
PRIVATE WRITABLE - size of mapping per instance