[libvirt] [PATCH 2/8] qemu: cgroup: Refactor setup for IOThread cgroups

Peter Krempa pkrempa at redhat.com
Fri Mar 27 13:12:06 UTC 2015


Use the default or auto cpuset if they are provided for IOThreads.
---
 src/qemu/qemu_cgroup.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index bc7632f..be02ede 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -1255,21 +1255,26 @@ qemuSetupCgroupForIOThreads(virDomainObjPtr vm)
         /* Set iothreadpin in cgroup if iothreadpin xml is provided */
         if (virCgroupHasController(priv->cgroup,
                                    VIR_CGROUP_CONTROLLER_CPUSET)) {
-            /* find the right CPU to pin, otherwise
-             * qemuSetupCgroupIOThreadsPin will fail. */
-            for (j = 0; j < def->cputune.niothreadspin; j++) {
-                /* IOThreads are numbered/named 1..n */
-                if (def->cputune.iothreadspin[j]->id != i + 1)
-                    continue;
+            virBitmapPtr cpumask = NULL;

-                if (qemuSetupCgroupIOThreadsPin(cgroup_iothread,
-                                                def->cputune.iothreadspin,
-                                                def->cputune.niothreadspin,
-                                                i + 1) < 0)
-                    goto cleanup;
+            /* default cpu masks */
+            if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)
+                cpumask = priv->autoCpuset;
+            else
+                cpumask = def->cpumask;

-                break;
+            /* specific cpu mask */
+            for (j = 0; j < def->cputune.niothreadspin; j++) {
+                /* IOThreads are numbered/named 1..n */
+                if (def->cputune.iothreadspin[j]->id == i + 1) {
+                    cpumask = def->cputune.iothreadspin[j]->cpumask;
+                    break;
+                }
             }
+
+            if (cpumask &&
+                qemuSetupCgroupEmulatorPin(cgroup_iothread, cpumask) < 0)
+                goto cleanup;
         }

         virCgroupFree(&cgroup_iothread);
-- 
2.2.2




More information about the libvir-list mailing list