]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_command: Introduce qemuBuildThreadContextProps()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 2 Nov 2022 11:08:52 +0000 (12:08 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 15 Nov 2022 10:47:08 +0000 (11:47 +0100)
commitb03386d14862e1e1632dbedd5d1a5f0db80b0d98
treed60e093bfdc95523f4acd608d03c3a6ae93dad06
parentd5320907e34e26f8c05dd9827dbed1cf24397be6
qemu_command: Introduce qemuBuildThreadContextProps()

The aim of thread-context object is to set affinity on threads
that allocate memory for a memory-backend-* object. For instance:

-object '{"qom-type":"thread-context","id":"tc-ram-node0","node-affinity":[3]}' \
-object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,\
          "hugetlbsize":2097152,"share":true,"prealloc":true,"prealloc-threads":8,\
          "size":15032385536,"host-nodes":[3],"policy":"preferred",\
          "prealloc-context":"tc-ram-node0"}' \

allocates 14GiB worth of memory, backed by 2MiB hugepages from
host NUMA node 3, using 8 threads. If it weren't for
thread-context these threads wouldn't have any affinity and thus
theoretically could be scheduled to run on CPUs of different NUMA
node (which is what I saw occasionally).

Therefore, whenever we are pinning memory (IOW setting host-nodes
attribute), we can generate thread-context object with the same
affinity.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_command.c
src/qemu/qemu_command.h