1 The Linux kernel supports the following overcommit handling modes
3 0 - Heuristic overcommit handling. Obvious overcommits of
4 address space are refused. Used for a typical system. It
5 ensures a seriously wild allocation fails while allowing
6 overcommit to reduce swap usage. root is allowed to
7 allocate slighly more memory in this mode. This is the
10 1 - Always overcommit. Appropriate for some scientific
13 2 - Don't overcommit. The total address space commit
14 for the system is not permitted to exceed swap + a
15 configurable percentage (default is 50) of physical RAM.
16 Depending on the percentage you use, in most situations
17 this means a process will not be killed while accessing
18 pages but will receive errors on memory allocation as
21 The overcommit policy is set via the sysctl `vm.overcommit_memory'.
23 The overcommit percentage is set via `vm.overcommit_ratio'.
25 The current overcommit limit and amount committed are viewable in
26 /proc/meminfo as CommitLimit and Committed_AS respectively.
31 The C language stack growth does an implicit mremap. If you want absolute
32 guarantees and run close to the edge you MUST mmap your stack for the
33 largest size you think you will need. For typical stack usage this does
34 not matter much but it's a corner case if you really really care
36 In mode 2 the MAP_NORESERVE flag is ignored.
42 The overcommit is based on the following rules
45 SHARED or READ-only - 0 cost (the file is the map not swap)
46 PRIVATE WRITABLE - size of mapping per instance
48 For an anonymous or /dev/zero map
49 SHARED - size of mapping
50 PRIVATE READ-only - 0 cost (but of little use)
51 PRIVATE WRITABLE - size of mapping per instance
54 Pages made writable copies by mmap
55 shmfs memory drawn from the same pool
60 o We account mmap memory mappings
61 o We account mprotect changes in commit
62 o We account mremap changes in size
65 o We report the commit status in /proc
66 o Account and check on fork
67 o Review stack handling/building on exec
69 o Implement actual limit enforcement
73 o Account ptrace pages (this is hard)