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)

Share:
7,737

Related videos on Youtube

Brando___
Author by

Brando___

Updated on September 18, 2022

Comments

  • Brando___
    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
      Andrew Henle over 4 years
      Completely 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
      marty over 2 years
      and 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 ;(