render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From 957c2c3adaee341fdd33e4eff598a215d0034b2f Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <957c2c3adaee341fdd33e4eff598a215d0034b2f@dist-git>
9119d9
From: Wang Rui <moon.wangrui@huawei.com>
9119d9
Date: Tue, 27 Jan 2015 11:40:08 +0100
9119d9
Subject: [PATCH] qemu: don't setup cpuset.mems if memory mode in numatune is
9119d9
 not 'strict'
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1186094
9119d9
9119d9
If the memory mode in numatune is specified as 'preferred' with one node
9119d9
(such as nodeset='0'), domain's memory is not all in node 0 absolutely.
9119d9
Assumption that node 0 doesn't have enough memory, memory can be allocated
9119d9
on node 1 when qemu process startup. Then if we set cpuset.mems to '0',
9119d9
it may invoke OOM.
9119d9
9119d9
Commit 1a7be8c600905aa07ac2d78293336ba8523ad48e changed the former logic of
9119d9
checking memory mode in virDomainNumatuneGetNodeset. This patch adds the
9119d9
check as before.
9119d9
9119d9
Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
9119d9
(cherry picked from commit 38a0f6df6473edb62e9ce25df5a0a81e8ac81d77)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_cgroup.c | 4 ++++
9119d9
 1 file changed, 4 insertions(+)
9119d9
9119d9
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
9119d9
index 8824426..af5b59e 100644
9119d9
--- a/src/qemu/qemu_cgroup.c
9119d9
+++ b/src/qemu/qemu_cgroup.c
9119d9
@@ -619,6 +619,10 @@ qemuSetupCpusetMems(virDomainObjPtr vm)
9119d9
     if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
9119d9
         return 0;
9119d9
 
9119d9
+    if (virDomainNumatuneGetMode(vm->def->numatune, -1) !=
9119d9
+        VIR_DOMAIN_NUMATUNE_MEM_STRICT)
9119d9
+        return 0;
9119d9
+
9119d9
     if (virDomainNumatuneMaybeFormatNodeset(vm->def->numatune,
9119d9
                                             priv->autoNodeset,
9119d9
                                             &mem_mask, -1) < 0)
9119d9
-- 
9119d9
2.2.2
9119d9