oom-killer
can be disabled for some processes. You can do this on your responsibility because in some situations virtually any of processes can become very “greedy” and therefore a candidate to be killed.
There are multiple ways how to implement disabling oom-killer
. One of the “quick&dirty” but reliable ones is to add into /etc/rc.local
something like:
echo -17 > /proc/$(ps -C kresd -o pid --no-headers)/oom_adj
This command is run after the entire system is initialized and disables oom-killer
for kresd
. It should be of course rewritten to a better form (which will test the result of ps
for example) for real use. You can also only set oom-killer
to lower probability (by setting a negative value between -1 and -16) instead of disabling at all.