1) Configuring OOM killer: The values in overcommit_memory mean
0-Heuristic memory overcommit (default setting)
1-Always overcommit
2-Disable overcommit
When overcommit_memory is set to 2 ,the total address space commit for the system is not permitted to exceed swap + configurable percentage (default is 50) of physical RAM. The default value can be changed to 75 using
echo "75">/proc/sys/vm/overcommit_ratio.
However if your trying to tune the killer for a particular process you can write any value between -16 to +15 the higher value means that process is more likely to be the victim of OOM killer to/proc/pid/oom_adj
. Values -17 exempts process from OOM killer.
The value /proc/pid/oom_score
is the badness score the higher the score more likely the process will be victim.
2) Disabling OOM killer
You can completely disable the OOM killer using
`sysctl vm.overcommit_memory=2`
`echo "vm.overcommit_memory=2" >> /etc/sysctl.conf`
There are several files under /proc/sys/vm/ directory: overcommit_memory, overcommit_ratio;
If you want to limit the max memory used process to 75%, you can try following commands:
echo 2 > /proc/sys/vm/overcommit_memory echo 75 > /proc/sys/vm/overcommit_ratio
If you want to disable the OOM killer, you can try following command:
echo 1 > /proc/sys/vm/overcommit_memory
The OOM killer is part of Linux Kernel, so it is running in kernel space.