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

[libvirt] [PATCH 5/5] qemu: process: Pin on per-vcpu basis instead of per-vcpupin element



Pin existing vcpus rather than existing vcpu pinning infos. This
increases the complexity of the lookup, but avoids pinning cpus that are
not enabled actually.
---
 src/qemu/qemu_process.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index fe8fd2a..cfd7ee1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2230,7 +2230,8 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     virDomainDefPtr def = vm->def;
-    int vcpu, n;
+    virDomainVcpuPinDefPtr pininfo;
+    int n;
     int ret = -1;

     if (!def->cputune.nvcpupin)
@@ -2242,11 +2243,15 @@ qemuProcessSetVcpuAffinities(virDomainObjPtr vm)
         return -1;
     }

-    for (n = 0; n < def->cputune.nvcpupin; n++) {
-        vcpu = def->cputune.vcpupin[n]->vcpuid;
+    for (n = 0; n < def->vcpus; n++) {
+        /* set affinity only for existing vcpus */
+        if (!(pininfo = virDomainVcpuPinFindByVcpu(def->cputune.vcpupin,
+                                                   def->cputune.nvcpupin,
+                                                   n)))
+            continue;

-        if (virProcessSetAffinity(priv->vcpupids[vcpu],
-                                  def->cputune.vcpupin[n]->cpumask) < 0) {
+        if (virProcessSetAffinity(priv->vcpupids[n],
+                                  pininfo->cpumask) < 0) {
             goto cleanup;
         }
     }
-- 
2.0.2


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