[PATCH 9/9] qemu_cgroup: assert threading cgroup layout for machine cgroup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make sure the thread related controls of the machine cgroup never
get any tasks assigned.

Signed-off-by: Henning Schild <henning.schild@xxxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]