Revert "qemu: do not put a task into machine cgroup"

This reverts commit a41c00b472.

After much testing and upstream discussion this has been deemed to be
the incorrect operation since it means we no longer have any guarantee
about which resource controllers the QEMU processes in general are in.
This commit is contained in:
John Ferlan
2016-01-14 10:56:53 -05:00
parent c726af2d5a
commit f8f6907284
2 changed files with 17 additions and 10 deletions

View File

@@ -789,6 +789,17 @@ qemuInitCgroup(virQEMUDriverPtr driver,
goto cleanup; 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: done:
ret = 0; ret = 0;
cleanup: cleanup:
@@ -1160,10 +1171,6 @@ qemuSetupCgroupForEmulator(virDomainObjPtr vm)
goto cleanup; goto cleanup;
} }
/* consider the first thread an emulator-thread */
if (virCgroupAddTask(cgroup_emulator, vm->pid) < 0)
goto cleanup;
virCgroupFree(&cgroup_emulator); virCgroupFree(&cgroup_emulator);
return 0; return 0;

View File

@@ -4895,6 +4895,12 @@ qemuProcessLaunch(virConnectPtr conn,
if (qemuSetupCgroup(driver, vm, nnicindexes, nicindexes) < 0) if (qemuSetupCgroup(driver, vm, nnicindexes, nicindexes) < 0)
goto cleanup; 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"); VIR_DEBUG("Setting domain security labels");
if (virSecurityManagerSetAllLabel(driver->securityManager, if (virSecurityManagerSetAllLabel(driver->securityManager,
vm->def, vm->def,
@@ -4941,12 +4947,6 @@ qemuProcessLaunch(virConnectPtr conn,
if (qemuSetupCgroupForEmulator(vm) < 0) if (qemuSetupCgroupForEmulator(vm) < 0)
goto cleanup; 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"); VIR_DEBUG("Setting affinity of emulator threads");
if (qemuProcessSetEmulatorAffinity(vm) < 0) if (qemuProcessSetEmulatorAffinity(vm) < 0)
goto cleanup; goto cleanup;