3

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
1
  • 1
    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. – Andrew Henle Nov 18 '19 at 10:31
4

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)

1
  • 3
    Shouldn't that be echo 2 > /proc/sys/vm/overcommit_memory? The linked documentation states 2 - Don't overcommit. – Andrew Henle Nov 18 '19 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.