[PATCH 2/3] qemu: Allow more generous cpuset.mems for vCPUs and IOThreads

Michal Privoznik mprivozn at redhat.com
Wed Jun 7 14:41:00 UTC 2023


The unit that cpuset CGroups controller works with is a
thread/process, not individual memory allocations. Therefore,
after we've set cpuset.mems for emulator (after previous commit
it's set to union of all host NUMA nodes allowed for given
domain), and as we try to set up cpuset.mems for vCPUs/IOThreads,
memory is migrated to selected NUMA node(s). We are effectively
saying: "this thread (vCPU thread) can have memory only from
these NUMA node(s)".

That's not really what we want though. The cpuset controller
doesn't differentiate memory "belonging" to the emulator thread
and vCPU thread or IOThread even.

Therefore, set union of all allowed host NUMA nodes, just like
we're doing for the emulator thread.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2138150
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/qemu/qemu_process.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1d3cdeff9a..d9269e37a1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2598,7 +2598,6 @@ qemuProcessSetupPid(virDomainObj *vm,
             /* QEMU allocates its memory from the emulator thread. Thus it
              * needs to access union of all host nodes configured. */
             if (unionMems &&
-                nameval == VIR_CGROUP_THREAD_EMULATOR &&
                 mem_mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
                 qemuDomainNumatuneMaybeFormatNodesetUnion(vm, NULL, &mem_mask);
             } else {
@@ -5911,7 +5910,7 @@ qemuProcessSetupVcpu(virDomainObj *vm,
                             vm->def->cputune.period,
                             vm->def->cputune.quota,
                             &vcpu->sched,
-                            false) < 0)
+                            true) < 0)
         return -1;
 
     if (schedCore &&
@@ -6067,7 +6066,7 @@ qemuProcessSetupIOThread(virDomainObj *vm,
                                vm->def->cputune.iothread_period,
                                vm->def->cputune.iothread_quota,
                                &iothread->sched,
-                               false);
+                               true);
 }
 
 
-- 
2.39.3



More information about the libvir-list mailing list