'numad' may return a nodeset which contains NUMA nodes without memory
for certain configurations. Since cgroups code will not be happy using
nodes without memory we need to store only numa nodes with memory in
autoNodeset.
On the other hand autoCpuset should contain cpus also for nodes which
do not have any memory.
---
src/qemu/qemu_process.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 01fe33c92..78c5692a0 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5416,6 +5416,8 @@ qemuProcessPrepareDomainNUMAPlacement(virDomainObjPtr vm,
{
qemuDomainObjPrivatePtr priv = vm->privateData;
char *nodesetstr = NULL;
+ virBitmapPtr numadNodeset = NULL;
+ virBitmapPtr hostMemoryNodeset = NULL;
int ret = -1;
/* Get the advisory nodeset from numad if 'placement' of
@@ -5430,20 +5432,30 @@ qemuProcessPrepareDomainNUMAPlacement(virDomainObjPtr vm,
if (!nodesetstr)
goto cleanup;
+ if (!(hostMemoryNodeset = virNumaGetHostMemoryNodeset()))
+ goto cleanup;
+
VIR_DEBUG("Nodeset returned from numad: %s", nodesetstr);
- if (virBitmapParse(nodesetstr, &priv->autoNodeset,
- VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(nodesetstr, &numadNodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
- if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps,
- priv->autoNodeset)))
+ /* numad may return a nodeset that only contains cpus but cgroups don't play
+ * well with that. Set the autoCpuset from all cpus from that nodeset, but
+ * assign autoNodeset only with nodes containing memory. */
+ if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps, numadNodeset)))
goto cleanup;
+ virBitmapIntersect(numadNodeset, hostMemoryNodeset);
+
+ VIR_STEAL_PTR(priv->autoNodeset, numadNodeset);
+
ret = 0;
cleanup:
VIR_FREE(nodesetstr);
+ virBitmapFree(numadNodeset);
+ virBitmapFree(hostMemoryNodeset);
return ret;
}
--
2.12.2