[libvirt] [PATCH 2/3] qemu: do not put a task into machine cgroup

Henning Schild henning.schild at siemens.com
Fri Nov 13 16:57:00 UTC 2015


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 at siemens.com>
---
 src/qemu/qemu_cgroup.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 28d2ca2..2c74a22 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -769,12 +769,6 @@ qemuInitCgroup(virQEMUDriverPtr driver,
         goto cleanup;
     }
 
-    if (virCgroupAddTask(priv->cgroup, vm->pid) < 0) {
-        virCgroupRemove(priv->cgroup);
-        virCgroupFree(&priv->cgroup);
-        goto cleanup;
-    }
-
  done:
     ret = 0;
  cleanup:
@@ -1145,6 +1139,10 @@ 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;
 
-- 
2.4.10




More information about the libvir-list mailing list