The automatic cpuset can be stored along with automatic nodeset and it
does not have to be recreated when used.
---
src/qemu/qemu_cgroup.c | 21 +++++----------------
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 3 +++
src/qemu/qemu_process.c | 11 +++++++----
4 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index a422fbc..bc7632f 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -642,8 +642,7 @@ qemuSetupCpusetMems(virDomainObjPtr vm)
static int
-qemuSetupCpusetCgroup(virDomainObjPtr vm,
- virCapsPtr caps)
+qemuSetupCpusetCgroup(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
char *cpu_mask = NULL;
@@ -658,15 +657,10 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,
if (vm->def->cpumask ||
(vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)) {
- if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
- virBitmapPtr cpumap;
- if (!(cpumap = virCapabilitiesGetCpusForNodemask(caps,
priv->autoNodeset)))
- goto cleanup;
- cpu_mask = virBitmapFormat(cpumap);
- virBitmapFree(cpumap);
- } else {
+ if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)
+ cpu_mask = virBitmapFormat(priv->autoCpuset);
+ else
cpu_mask = virBitmapFormat(vm->def->cpumask);
- }
if (!cpu_mask)
goto cleanup;
@@ -896,7 +890,6 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
int *nicindexes)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
- virCapsPtr caps = NULL;
int ret = -1;
if (!vm->pid) {
@@ -911,9 +904,6 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
if (!priv->cgroup)
return 0;
- if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
- goto cleanup;
-
if (qemuSetupDevicesCgroup(driver, vm) < 0)
goto cleanup;
@@ -926,12 +916,11 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
if (qemuSetupCpuCgroup(driver, vm) < 0)
goto cleanup;
- if (qemuSetupCpusetCgroup(vm, caps) < 0)
+ if (qemuSetupCpusetCgroup(vm) < 0)
goto cleanup;
ret = 0;
cleanup:
- virObjectUnref(caps);
return ret;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 758fcd9..d1be66e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -458,6 +458,7 @@ qemuDomainObjPrivateFree(void *data)
}
VIR_FREE(priv->cleanupCallbacks);
virBitmapFree(priv->autoNodeset);
+ virBitmapFree(priv->autoCpuset);
VIR_FREE(priv);
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index b854b54..e4140d8 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -191,7 +191,10 @@ struct _qemuDomainObjPrivate {
char **qemuDevices; /* NULL-terminated list of devices aliases known to QEMU */
bool hookRun; /* true if there was a hook run over this domain */
+
+ /* Bitmaps below hold data from the auto NUMA feature */
virBitmapPtr autoNodeset;
+ virBitmapPtr autoCpuset;
};
typedef enum {
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 79f763e..4a786b1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4321,7 +4321,6 @@ int qemuProcessStart(virConnectPtr conn,
size_t i;
bool rawio_set = false;
char *nodeset = NULL;
- virBitmapPtr nodemask = NULL;
unsigned int stop_flags;
virQEMUDriverConfigPtr cfg;
virCapsPtr caps = NULL;
@@ -4582,10 +4581,14 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DEBUG("Nodeset returned from numad: %s", nodeset);
- if (virBitmapParse(nodeset, 0, &nodemask, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(nodeset, 0, &priv->autoNodeset,
+ VIR_DOMAIN_CPUMASK_LEN) < 0)
+ goto cleanup;
+
+ if (!(priv->autoCpuset = virCapabilitiesGetCpusForNodemask(caps,
+
priv->autoNodeset)))
goto cleanup;
}
- priv->autoNodeset = nodemask;
/* "volume" type disk's source must be translated before
* cgroup and security setting.
@@ -4652,7 +4655,7 @@ int qemuProcessStart(virConnectPtr conn,
migrateFrom, stdin_fd, snapshot, vmop,
&buildCommandLineCallbacks, false,
qemuCheckFips(),
- nodemask,
+ priv->autoNodeset,
&nnicindexes, &nicindexes)))
goto cleanup;
--
2.2.2