Make sure the thread related controls of the machine cgroup never
get any tasks assigned.
Signed-off-by: Henning Schild <henning.schild(a)siemens.com>
---
src/qemu/qemu_cgroup.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 99fb5bf..c827787 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -740,6 +740,7 @@ qemuInitCgroup(virQEMUDriverPtr driver,
int *nicindexes)
{
int ret = -1;
+ int assert_empty, controllers;
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
@@ -789,8 +790,17 @@ qemuInitCgroup(virQEMUDriverPtr driver,
goto cleanup;
}
- if (virCgroupAddTask(priv->cgroup, vm->pid,
- ~VIR_CGROUP_THREAD_CONTROLLER_MASK) < 0) {
+ /*
+ * the child cgroups for emulator, vcpu, and io -threads contain
+ * all qemu threads for the following controllers, the parent
+ * group has to stay empty.
+ */
+ controllers = VIR_CGROUP_THREAD_CONTROLLER_MASK;
+ assert_empty = virCgroupGetAssertEmpty(priv->cgroup);
+ assert_empty |= controllers;
+ virCgroupSetAssertEmpty(priv->cgroup, assert_empty);
+
+ if (virCgroupAddTask(priv->cgroup, vm->pid, ~controllers) < 0) {
virErrorPtr saved = virSaveLastError();
virCgroupRemove(priv->cgroup);
virCgroupFree(&priv->cgroup);
--
2.4.10