From: Peter Krempa Date: Tue, 18 Jan 2022 09:06:38 +0000 (+0100) Subject: qemuDomainPinIOThread: Copy the cpu bitmap instead of re-parsing it X-Git-Tag: v8.1.0-rc1~411 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dcfa6c650d44a640b1869bac941fb89c88f7e2cf;p=thirdparty%2Flibvirt.git qemuDomainPinIOThread: Copy the cpu bitmap instead of re-parsing it 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 Reviewed-by: Ján Tomko Reviewed-by: Pavel Hrdina --- 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);