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

[libvirt] [PATCH] Fix initial VCPU pinning in qemu driver



First, inital VCPU pinning is set correctly but then it is reset by
assigning qemu process to a new cgroup (which contains all CPUs). It's
easily fixed by swapping these two actions.
---
 src/qemu/qemu_driver.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Originally, I thought it would be better to change the initial pinning
at cgroup level but then I realized it was not a good idea. AFAIK cgroup
olny works for processes and is not usable for per-VCPU pinning. That
is, it is fine to have all CPUs in cgroup and fine tune VCPU pinning by
setting procss affinity.

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5f4adfd..cc3e3b2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3081,10 +3081,10 @@ static int qemudSecurityHook(void *data) {
     /* This must take place before exec(), so that all QEMU
      * memory allocation is on the correct NUMA node
      */
-    if (qemudInitCpuAffinity(h->vm) < 0)
+    if (qemuAddToCgroup(h->driver, h->vm->def) < 0)
         return -1;
 
-    if (qemuAddToCgroup(h->driver, h->vm->def) < 0)
+    if (qemudInitCpuAffinity(h->vm) < 0)
         return -1;
 
     if (h->driver->securityDriver &&
-- 
1.7.0.4


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