]> xenbits.xensource.com Git - libvirt.git/commit
qemu: Rework setting process affinity
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 30 Jan 2019 08:46:23 +0000 (09:46 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 1 Feb 2019 11:53:46 +0000 (12:53 +0100)
commitf136b83139c63f20de0df3285d9e82df2fb97bfc
treeeb7399397f25fa103ef8674f057c6d5631186664
parenta2d3dea9d41dba313d9566120a8ec9d358567bd0
qemu: Rework setting process affinity

https://bugzilla.redhat.com/show_bug.cgi?id=1503284

The way we currently start qemu from CPU affinity POV is as
follows:

  1) the child process is set affinity to all online CPUs (unless
  some vcpu pinning was given in the domain XML)

  2) Once qemu is running, cpuset cgroup is configured taking
  memory pinning into account

Problem is that we let qemu allocate its memory just anywhere in
1) and then rely in 2) to be able to move the memory to
configured NUMA nodes. This might not be always possible (e.g.
qemu might lock some parts of its memory) and is very suboptimal
(copying large memory between NUMA nodes takes significant amount
of time).

The solution is to set affinity to one of (in priority order):
  - The CPUs associated with NUMA memory affinity mask
  - The CPUs associated with emulator pinning
  - All online host CPUs

Later (once QEMU has allocated its memory) we then change this
again to (again in priority order):
  - The CPUs associated with emulator pinning
  - The CPUs returned by numad
  - The CPUs associated with vCPU pinning
  - All online host CPUs

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_process.c