Inside of qemuProcessSetupPid() there's @numatune variable which
is set to vm->def->numa, but it lives only in one block. In the
rest of places the expanded form (vm->def->numa) is used instead.
Move the variable declaration at the beginning of the function
and use it instead of the expanded form.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_process.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ce5ed6389a..57c3ea2dbf 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2553,6 +2553,7 @@ qemuProcessSetupPid(virDomainObj *vm,
virDomainThreadSchedParam *sched)
{
qemuDomainObjPrivate *priv = vm->privateData;
+ virDomainNuma *numatune = vm->def->numa;
virDomainNumatuneMemMode mem_mode;
virCgroup *cgroup = NULL;
virBitmap *use_cpumask = NULL;
@@ -2589,10 +2590,10 @@ qemuProcessSetupPid(virDomainObj *vm,
if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU) ||
virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET)) {
- if (virDomainNumatuneGetMode(vm->def->numa, -1, &mem_mode) == 0
&&
+ if (virDomainNumatuneGetMode(numatune, -1, &mem_mode) == 0 &&
(mem_mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT ||
mem_mode == VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) &&
- virDomainNumatuneMaybeFormatNodeset(vm->def->numa,
+ virDomainNumatuneMaybeFormatNodeset(numatune,
priv->autoNodeset,
&mem_mask, -1) < 0)
goto cleanup;
@@ -2601,8 +2602,6 @@ qemuProcessSetupPid(virDomainObj *vm,
* threads based on the node they are in as there is nothing else uses
* for such restriction (e.g. numa_set_membind). */
if (nameval == VIR_CGROUP_THREAD_VCPU) {
- virDomainNuma *numatune = vm->def->numa;
-
/* Look for the guest NUMA node of this vCPU */
for (i = 0; i < virDomainNumaGetNodeCount(numatune); i++) {
virBitmap *node_cpus = virDomainNumaGetNodeCpumask(numatune, i);
--
2.39.3