This reverts commit a41c00b472efaa192d2deae51ab732e65903238f.
The patch was causing erroneous updates to the /proc/$pid/cgroup file.
This resulted in some unexpected behavoirs.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_cgroup.c | 15 +++++++++++----
src/qemu/qemu_process.c | 12 ++++++------
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 515d76a..16c6492 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -789,6 +789,17 @@ qemuInitCgroup(virQEMUDriverPtr driver,
goto cleanup;
}
+ if (virCgroupAddTask(priv->cgroup, vm->pid) < 0) {
+ virErrorPtr saved = virSaveLastError();
+ virCgroupRemove(priv->cgroup);
+ virCgroupFree(&priv->cgroup);
+ if (saved) {
+ virSetError(saved);
+ virFreeError(saved);
+ }
+ goto cleanup;
+ }
+
done:
ret = 0;
cleanup:
@@ -1157,10 +1168,6 @@ qemuSetupCgroupForEmulator(virDomainObjPtr vm)
goto cleanup;
}
- /* consider the first thread an emulator-thread */
- if (virCgroupAddTask(cgroup_emulator, vm->pid) < 0)
- goto cleanup;
-
virCgroupFree(&cgroup_emulator);
return 0;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 3d9e0e5..76df860 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4894,6 +4894,12 @@ qemuProcessLaunch(virConnectPtr conn,
if (qemuSetupCgroup(driver, vm, nnicindexes, nicindexes) < 0)
goto cleanup;
+ /* This must be done after cgroup placement to avoid resetting CPU
+ * affinity */
+ if (!vm->def->cputune.emulatorpin &&
+ qemuProcessInitCpuAffinity(vm) < 0)
+ goto cleanup;
+
VIR_DEBUG("Setting domain security labels");
if (virSecurityManagerSetAllLabel(driver->securityManager,
vm->def,
@@ -4940,12 +4946,6 @@ qemuProcessLaunch(virConnectPtr conn,
if (qemuSetupCgroupForEmulator(vm) < 0)
goto cleanup;
- /* This must be done after cgroup placement to avoid resetting CPU
- * affinity */
- if (!vm->def->cputune.emulatorpin &&
- qemuProcessInitCpuAffinity(vm) < 0)
- goto cleanup;
-
VIR_DEBUG("Setting affinity of emulator threads");
if (qemuProcessSetEmulatorAffinity(vm) < 0)
goto cleanup;
--
2.5.0