]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: cgroup: Refactor setup for IOThread cgroups
authorPeter Krempa <pkrempa@redhat.com>
Fri, 27 Mar 2015 12:22:02 +0000 (13:22 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 2 Apr 2015 08:12:08 +0000 (10:12 +0200)
Use the default or auto cpuset if they are provided for IOThreads.

src/qemu/qemu_cgroup.c

index bc7632ffe92fb0f321eafe427e5e06bb31cd94d9..be02edef1a3a897a0696f170c295d9f2be6a6d12 100644 (file)
@@ -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);