]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virnuma: Allow multiple nodes for preferred policy
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 9 Dec 2022 13:41:24 +0000 (14:41 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 14 Dec 2022 15:07:04 +0000 (16:07 +0100)
commit53369ad062eea7cd0f5fb9c67ab313ca2bf60721
treea730de4936b0d37489395e35adc9da920437fb01
parent7166d26fc91a6feb8065fe12f79a26de40a15f74
virnuma: Allow multiple nodes for preferred policy

In the past, the preferred policy
(VIR_DOMAIN_NUMATUNE_MEM_PREFERRED) required exactly one (host)
NUMA node. This made sense because:

  1) the libnuma API - numa_set_preferred() allowed exactly one
     node, because
  2) corresponding kernel syscall (__NR_set_mempolicy) accepted
     exactly one node (for MPOL_PREFERRED mode).

But things have changed since then. Firstly, kernel introduced
new MPOL_PREFERRED_MANY mode (v5.15-rc1~107^2~21) which was then
exposed in libnuma as numa_set_preferred_many() (v2.0.15~24).

Fortunately, libnuma also exposes numa_has_preferred_many() which
returns whether the kernel has support for the new mode (1) or
not (0).

Putting this all together, we can lift our check for sufficiently
new kernel and libnuma.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2151064
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
meson.build
src/util/virnuma.c