]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Relax hard RSS limit
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 8 Jan 2013 09:15:49 +0000 (10:15 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 8 Jan 2013 15:32:11 +0000 (16:32 +0100)
commit3c83df679e8feab939c08b1f97c48f9290a5b8cd
tree0a884f69e0fd2b3518d71184531eb659e0c5f0aa
parent51811e4161d1a830ae3e2141767d707c2891ed5a
qemu: Relax hard RSS limit

Currently, if there's no hard memory limit defined for a domain,
libvirt tries to calculate one, based on domain definition and magic
equation and set it upon the domain startup. The rationale behind was,
if there's a memory leak or exploit in qemu, we should prevent the
host system trashing. However, the equation was too tightening, as it
didn't reflect what the kernel counts into the memory used by a
process. Since many hosts do have a swap, nobody hasn't noticed
anything, because if hard memory limit is reached, process can
continue allocating memory on a swap. However, if there is no swap on
the host, the process gets killed by OOM killer. In our case, the qemu
process it is.

To prevent this, we need to relax the hard RSS limit. Moreover, we
should reflect more precisely the kernel way of accounting the memory
for process. That is, even the kernel caches are counted within the
memory used by a process (within cgroups at least). Hence the magic
equation has to be changed:

  limit = 1.5 * (domain memory + total video memory) + (32MB for cache
          per each disk) + 200MB
src/qemu/qemu_cgroup.c