qemu: Relax hard RSS limit
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

iam-TJ/libvirt,crobinso/libvirt,cbosdo/libvirt,bjzhang/libvirt,shugaoye/libvirt,trainstack/libvirt,taget/libvirt,rlaager/libvirt,eskultety/libvirt,zhlcindy/libvirt-1.1.4-maintain,agx/libvirt,libvirt/libvirt,nertpinx/libvirt,agx/libvirt,nertpinx/libvirt,elmarco/libvirt,cbosdo/libvirt,crobinso/libvirt,datto/libvirt,bjzhang/libvirt,VenkatDatta/libvirt,elmarco/libvirt,trainstack/libvirt,jardasgit/libvirt,libvirt/libvirt,eskultety/libvirt,siboulet/libvirt-openvz,rlaager/libvirt,jfehlig/libvirt,taget/libvirt,jardasgit/libvirt,olafhering/libvirt,agx/libvirt,trainstack/libvirt,zhlcindy/libvirt-1.1.4-maintain,datto/libvirt,agx/libvirt,trainstack/libvirt,taget/libvirt,VenkatDatta/libvirt,cbosdo/libvirt,datto/libvirt,jardasgit/libvirt,bjzhang/libvirt,zippy2/libvirt,olafhering/libvirt,trainstack/libvirt,nertpinx/libvirt,VenkatDatta/libvirt,andreabolognani/libvirt,rlaager/libvirt,eskultety/libvirt,shugaoye/libvirt,siboulet/libvirt-openvz,iam-TJ/libvirt,andreabolognani/libvirt,zhlcindy/libvirt-1.1.4-maintain,trainstack/libvirt,jardasgit/libvirt,zippy2/libvirt,agx/libvirt,cbosdo/libvirt,datto/libvirt,siboulet/libvirt-openvz,taget/libvirt,trainstack/libvirt,elmarco/libvirt,fabianfreyer/libvirt,elmarco/libvirt,fabianfreyer/libvirt,fabianfreyer/libvirt,jfehlig/libvirt,zhlcindy/libvirt-1.1.4-maintain,iam-TJ/libvirt,jfehlig/libvirt,VenkatDatta/libvirt,elmarco/libvirt,taget/libvirt,andreabolognani/libvirt,siboulet/libvirt-openvz,andreabolognani/libvirt,libvirt/libvirt,crobinso/libvirt,shugaoye/libvirt,iam-TJ/libvirt,eskultety/libvirt,eskultety/libvirt,rlaager/libvirt,iam-TJ/libvirt,jardasgit/libvirt,olafhering/libvirt,zippy2/libvirt,VenkatDatta/libvirt,rlaager/libvirt,cbosdo/libvirt,zhlcindy/libvirt-1.1.4-maintain,bjzhang/libvirt,shugaoye/libvirt,fabianfreyer/libvirt,libvirt/libvirt,jfehlig/libvirt,siboulet/libvirt-openvz,shugaoye/libvirt,andreabolognani/libvirt,crobinso/libvirt,bjzhang/libvirt,nertpinx/libvirt,iam-TJ/libvirt,zippy2/libvirt,datto/libvirt,olafhering/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,iam-TJ/libvirt