Moving tasks to cgroups implied sched_setaffinity. Changing the cpus in
a set implies the same for all tasks in the group.
The old code put the the thread into the cpuset inherited from the
machine cgroup, which allowed it to run outside of vcpupin for a short
while.

Signed-off-by: Henning Schild <henning.sch...@siemens.com>
---
 src/qemu/qemu_cgroup.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 2c74a22..ab61a09 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -1030,10 +1030,6 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm)
                                true, &cgroup_vcpu) < 0)
             goto cleanup;
 
-        /* move the thread for vcpu to sub dir */
-        if (virCgroupAddTask(cgroup_vcpu, priv->vcpupids[i]) < 0)
-            goto cleanup;
-
         if (period || quota) {
             if (qemuSetupCgroupVcpuBW(cgroup_vcpu, period, quota) < 0)
                 goto cleanup;
@@ -1067,6 +1063,11 @@ qemuSetupCgroupForVcpu(virDomainObjPtr vm)
             if (qemuSetupCgroupCpusetCpus(cgroup_vcpu, cpumap) < 0)
                 goto cleanup;
         }
+
+        /* move the thread for vcpu to sub dir */
+        if (virCgroupAddTask(cgroup_vcpu, priv->vcpupids[i]) < 0)
+            goto cleanup;
+
     }
     virCgroupFree(&cgroup_vcpu);
     VIR_FREE(mem_mask);
@@ -1208,11 +1209,6 @@ qemuSetupCgroupForIOThreads(virDomainObjPtr vm)
                                true, &cgroup_iothread) < 0)
             goto cleanup;
 
-        /* move the thread for iothread to sub dir */
-        if (virCgroupAddTask(cgroup_iothread,
-                             def->iothreadids[i]->thread_id) < 0)
-            goto cleanup;
-
         if (period || quota) {
             if (qemuSetupCgroupVcpuBW(cgroup_iothread, period, quota) < 0)
                 goto cleanup;
@@ -1239,6 +1235,11 @@ qemuSetupCgroupForIOThreads(virDomainObjPtr vm)
                 goto cleanup;
         }
 
+        /* move the thread for iothread to sub dir */
+        if (virCgroupAddTask(cgroup_iothread,
+                             def->iothreadids[i]->thread_id) < 0)
+            goto cleanup;
+
         virCgroupFree(&cgroup_iothread);
     }
     VIR_FREE(mem_mask);
-- 
2.4.10

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

Reply via email to