]> xenbits.xensource.com Git - libvirt.git/commitdiff
numa: Rename virNumaGetHostNodeset and make it return only nodes with memory
authorPeter Krempa <pkrempa@redhat.com>
Tue, 13 Sep 2016 13:55:06 +0000 (15:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 14 Sep 2016 06:41:41 +0000 (08:41 +0200)
Name it virNumaGetHostMemoryNodeset and return only NUMA nodes which
have memory installed. This is necessary as the kernel is not very happy
to set the memory cgroup setting for nodes which do not have any memory.

This would break vcpu hotplug with following message on such
configruation:

  Invalid value '0,8' for 'cpuset.mems': Invalid argument

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1375268

src/libvirt_private.syms
src/qemu/qemu_cgroup.c
src/util/virnuma.c
src/util/virnuma.h

index 2569772ec22fe2402a8f5a8aaa9136e1a1704711..80d5e86d0e3465d9600eaa5986f9baef921fde4f 100644 (file)
@@ -2059,7 +2059,7 @@ virNodeSuspendGetTargetMask;
 # util/virnuma.h
 virNumaGetAutoPlacementAdvice;
 virNumaGetDistances;
-virNumaGetHostNodeset;
+virNumaGetHostMemoryNodeset;
 virNumaGetMaxNode;
 virNumaGetNodeMemory;
 virNumaGetPageInfo;
index fe94613b77d8ce7057f9f3f8b670072f46ce6ad6..4bce601facca25095ee11cc26e9804f583e806ea 100644 (file)
@@ -860,7 +860,7 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
     virBitmapPtr all_nodes;
     virCgroupPtr cgroup_temp = NULL;
 
-    if (!(all_nodes = virNumaGetHostNodeset()))
+    if (!(all_nodes = virNumaGetHostMemoryNodeset()))
         goto error;
 
     if (!(mem_mask = virBitmapFormat(all_nodes)))
@@ -1166,7 +1166,7 @@ qemuCgroupEmulatorAllNodesAllow(virCgroupPtr cgroup,
         !virCgroupHasController(cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
         return 0;
 
-    if (!(all_nodes = virNumaGetHostNodeset()))
+    if (!(all_nodes = virNumaGetHostMemoryNodeset()))
         goto cleanup;
 
     if (!(all_nodes_str = virBitmapFormat(all_nodes)))
index c4d11fa6e02deeb90282caba75431e969751b1d0..bebe301f8d2e4ed1f9ba848a6b32815cc9deac5c 100644 (file)
@@ -987,10 +987,17 @@ virNumaNodesetIsAvailable(virBitmapPtr nodeset)
     return true;
 }
 
+
+/**
+ * virNumaGetHostMemoryNodeset:
+ *
+ * Returns a bitmap of guest numa node ids that contain memory.
+ */
 virBitmapPtr
-virNumaGetHostNodeset(void)
+virNumaGetHostMemoryNodeset(void)
 {
     int maxnode = virNumaGetMaxNode();
+    unsigned long long nodesize;
     size_t i = 0;
     virBitmapPtr nodeset = NULL;
 
@@ -1004,7 +1011,9 @@ virNumaGetHostNodeset(void)
         if (!virNumaNodeIsAvailable(i))
             continue;
 
-        ignore_value(virBitmapSetBit(nodeset, i));
+        /* if we can't detect NUMA node size assume that it's present */
+        if (virNumaGetNodeMemory(i, &nodesize, NULL) < 0 || nodesize > 0)
+            ignore_value(virBitmapSetBit(nodeset, i));
     }
 
     return nodeset;
index 1f3c0ad8a75de51e85a1fecea9c5a0b2ab2fd4fa..f3eef324a4978fb89420c74bdab22f12e825ad58 100644 (file)
@@ -33,7 +33,7 @@ char *virNumaGetAutoPlacementAdvice(unsigned short vcups,
 int virNumaSetupMemoryPolicy(virDomainNumatuneMemMode mode,
                              virBitmapPtr nodeset);
 
-virBitmapPtr virNumaGetHostNodeset(void);
+virBitmapPtr virNumaGetHostMemoryNodeset(void);
 bool virNumaNodesetIsAvailable(virBitmapPtr nodeset);
 bool virNumaIsAvailable(void);
 int virNumaGetMaxNode(void);