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