]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: don't setup cpuset.mems if memory mode in numatune is not 'strict'
authorWang Rui <moon.wangrui@huawei.com>
Mon, 10 Nov 2014 13:53:17 +0000 (21:53 +0800)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 11 Nov 2014 11:14:09 +0000 (12:14 +0100)
If the memory mode in numatune is specified as 'preferred' with one node
(such as nodeset='0'), domain's memory is not all in node 0 absolutely.
Assumption that node 0 doesn't have enough memory, memory can be allocated
on node 1 when qemu process startup. Then if we set cpuset.mems to '0',
it may invoke OOM.

Commit 1a7be8c600905aa07ac2d78293336ba8523ad48e changed the former logic of
checking memory mode in virDomainNumatuneGetNodeset. This patch adds the
check as before.

Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
src/qemu/qemu_cgroup.c

index b5bdb362dac72a4d404cc19f86dac1244fd912d3..a87ef406a17ae4fe3f62a8509f3600d3c0a100c7 100644 (file)
@@ -618,6 +618,10 @@ qemuSetupCpusetMems(virDomainObjPtr vm,
     if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
         return 0;
 
+    if (virDomainNumatuneGetMode(vm->def->numatune, -1) !=
+        VIR_DOMAIN_NUMATUNE_MEM_STRICT)
+        return 0;
+
     if (virDomainNumatuneMaybeFormatNodeset(vm->def->numatune,
                                             nodemask,
                                             &mem_mask, -1) < 0)