qemu: do not put a task into machine cgroup

The machine cgroup is a superset, a parent to the emulator and vcpuX
cgroups. The parent cgroup should never have any tasks directly in it.
In fact the parent cpuset might contain way more cpus than the sum of
emulatorpin and vcpupins. So putting tasks in the superset will allow
them to run outside of <cputune>.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
This commit is contained in:
Henning Schild 2015-12-14 15:48:05 -05:00 committed by John Ferlan
parent 71ce475967
commit a41c00b472
2 changed files with 10 additions and 17 deletions

View File

@ -789,17 +789,6 @@ 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:
@ -1170,6 +1159,10 @@ 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

@ -4888,12 +4888,6 @@ 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,
@ -4940,6 +4934,12 @@ 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;