43fe83
From 1a0c6817d8b67ccd2f2b059bf4c15ca3ab5345d2 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <1a0c6817d8b67ccd2f2b059bf4c15ca3ab5345d2.1377873642.git.jdenemar@redhat.com>
43fe83
From: Michal Privoznik <mprivozn@redhat.com>
43fe83
Date: Mon, 26 Aug 2013 17:41:48 +0200
43fe83
Subject: [PATCH] qemuSetupMemoryCgroup: Handle hard_limit properly
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=1001143
43fe83
43fe83
Since 16bcb3 we have a regression. The hard_limit is set
43fe83
unconditionally. By default the limit is zero. Hence, if user hasn't
43fe83
configured any, we set the zero in cgroup subsystem making the kernel
43fe83
kill the corresponding qemu process immediately. The proper fix is to
43fe83
set hard_limit iff user has configured any.
43fe83
(cherry picked from commit 94a24dd3a953f415596dd2800287c9010fa51c4c)
43fe83
---
43fe83
 src/qemu/qemu_cgroup.c | 3 ++-
43fe83
 1 file changed, 2 insertions(+), 1 deletion(-)
43fe83
43fe83
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
43fe83
index f07c450..3ebbeb7 100644
43fe83
--- a/src/qemu/qemu_cgroup.c
43fe83
+++ b/src/qemu/qemu_cgroup.c
43fe83
@@ -428,7 +428,8 @@ qemuSetupMemoryCgroup(virDomainObjPtr vm)
43fe83
         }
43fe83
     }
43fe83
 
43fe83
-    if (virCgroupSetMemoryHardLimit(priv->cgroup, vm->def->mem.hard_limit) < 0)
43fe83
+    if (vm->def->mem.hard_limit != 0 &&
43fe83
+        virCgroupSetMemoryHardLimit(priv->cgroup, vm->def->mem.hard_limit) < 0)
43fe83
         return -1;
43fe83
 
43fe83
     if (vm->def->mem.soft_limit != 0 &&
43fe83
-- 
43fe83
1.8.3.2
43fe83