[PATCH 1/2] qemuDomainPinIOThread: Copy the cpu bitmap instead of re-parsing it

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

 



The bitmap recorded in the live/persistent definition was re-parsed two
more times. We can copy it which is cheaper and less verbose.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e150b86cef..077547e1d3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5011,7 +5011,6 @@ qemuDomainPinIOThread(virDomainPtr dom,

     if (def) {
         virDomainIOThreadIDDef *iothrid;
-        virBitmap *cpumask;

         if (!(iothrid = virDomainIOThreadIDFind(def, iothread_id))) {
             virReportError(VIR_ERR_INVALID_ARG,
@@ -5019,11 +5018,8 @@ qemuDomainPinIOThread(virDomainPtr dom,
             goto endjob;
         }

-        if (!(cpumask = virBitmapNewData(cpumap, maplen)))
-            goto endjob;
-
         virBitmapFree(iothrid->cpumask);
-        iothrid->cpumask = cpumask;
+        iothrid->cpumask = virBitmapNewCopy(pcpumap);
         iothrid->autofill = false;

         /* Configure the corresponding cpuset cgroup before set affinity. */
@@ -5060,7 +5056,6 @@ qemuDomainPinIOThread(virDomainPtr dom,

     if (persistentDef) {
         virDomainIOThreadIDDef *iothrid;
-        virBitmap *cpumask;

         if (!(iothrid = virDomainIOThreadIDFind(persistentDef, iothread_id))) {
             virReportError(VIR_ERR_INVALID_ARG,
@@ -5068,11 +5063,8 @@ qemuDomainPinIOThread(virDomainPtr dom,
             goto endjob;
         }

-        if (!(cpumask = virBitmapNewData(cpumap, maplen)))
-            goto endjob;
-
         virBitmapFree(iothrid->cpumask);
-        iothrid->cpumask = cpumask;
+        iothrid->cpumask = virBitmapNewCopy(pcpumap);
         iothrid->autofill = false;

         ret = virDomainDefSave(persistentDef, driver->xmlopt, cfg->configDir);
-- 
2.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux