Completely disable oom killer
7,737
You could use /proc/sys/vm/overcommit_memory
(see proc(5)), e.g.
echo 2 > /proc/sys/vm/overcommit_memory
as root to disable it. See also the kernel's Documentation/vm/overcommit-accounting
(If you are running an old kernel, consider upgrading it)
Related videos on Youtube
Author by
Brando___
Updated on September 18, 2022Comments
-
Brando___ almost 2 years
I'm having some intermittent issues that appear to be related to the oomkiller purging some child processes, but I can't see why.
Is there a convenient way that I can suppress all oomkiller activity through sysctl?
I've found some instructions that say these should work, but they do not exist for me.
sysctl -w memory.oom_control=1 sysctl -w vm.oom-kill=0
I have also seen these two being suggested, but the oom killer carries right on.
sysctl vm.overcommit_memory=2 sysctl vm.overcommit_kbytes=0
-
Andrew Henle over 4 yearsCompletely disabling memory overcommit on Linux can have some unexpected side effects as poorly-coded applications may just assume that memory overcommit will always be available so they'll obtain massively excessive amounts of anonymous virtual memory from the kernel. With memory overcommit disabled, those massive requests for anonymous virtual memory will require dedicated swap space. With memory overcommit disabled, for example, a
malloc()
call for 10 GB won't succeed unless there's 10 GB of free swap space available, which will then be reserved even if that 10 GB is never used. -
marty over 2 yearsand in that is the brain deadness - if the app is bad, then complain to the developer(s), not try and make them work and thus breaking systems - being an Infrastructure operator, it's pains me everytime this happens as it's always the process/application that is crucial that got badly killed ;(
-