kvm version: QEMU emulator version 1.1.2 (qemu-kvm-1.1.2+dfsg-6+deb7u3, Debian), Copyright (c) 2003-2008 Fabrice Bellard
libvirtd version: libvirtd (libvirt) 0.9.12.3
debian version: 7.5
I'm running multiple VMs on a 16GB RAM machine, all together they use ~9GB RAM.
Every now and then the linux oom killer comes over and kills a process. I guess it chooses the process using most of the memory – in this case a 6GB Windows VM:
[431215.778365] Out of memory: Kill process 25086 (kvm) score 192 or sacrifice child
IMHO the machine shouldn't be in an OOM Situation as there are ~6.6GB cached memory available. You can see the memory distribution and the resulting oom kill here:
I now have set the oom_adj
for the pid of the kvms to -17
, so the oom-killer won't kill this process.
But I'm still failing to understand why the kernel thinks it has to kill a process and won't go ahead and free some cached memory.
- Can anyone explain why this happens?
- Can you tell me how I can prevent the oom killer from killing my kvm processes without knowing the PID?
Best Answer
Just disable the
OOM Killer
for the particular process with:or by flavor
oom_score adj
.However:
In your case is to set also to
192
.See also Taming the OOM Killer
In any case, you should check also what causes the memory overflow, since the OOM Killer will kill other important processes.
Often it is observed a phenomenon called
overtuning
. In this case theovercommit_memory
as described here.Source proc filesystems:
oom_adj:
oom_score_adj: