[libvirt] [PATCH] qemu: Slightly increase memory limit

Jiri Denemark jdenemar at redhat.com
Mon Jul 8 13:20:28 UTC 2013


For low-memory domains (roughly under 400MB) our automatic memory limit
computation comes up with a limit that's too low. This is because the
0.5 multiplication does not add enough for such small values. Let's
increase the constant part of the computation to fix this.
---
 src/qemu/qemu_domain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 28b8ee4..c38c86e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2197,7 +2197,7 @@ qemuDomainMemoryLimit(virDomainDefPtr def)
          * limit' has been chosen:
          *     (1 + k) * (domain memory + total video memory) + (32MB for
          *     cache per each disk) + F
-         * where k = 0.5 and F = 200MB.  The cache for disks is important as
+         * where k = 0.5 and F = 400MB.  The cache for disks is important as
          * kernel cache on the host side counts into the RSS limit.
          * Moreover, VFIO requires some amount for IO space. Alex Williamson
          * suggested adding 1GiB for IO space just to be safe (some finer
@@ -2212,7 +2212,7 @@ qemuDomainMemoryLimit(virDomainDefPtr def)
             mem += def->videos[i]->vram;
         mem *= 1.5;
         mem += def->ndisks * 32768;
-        mem += 204800;
+        mem += 409600;
 
         for (i = 0; i < def->nhostdevs; i++) {
             virDomainHostdevDefPtr hostdev = def->hostdevs[i];
-- 
1.8.2.1




More information about the libvir-list mailing list