Before this patch set, numatune only has three memory modes:
static, interleave and prefered. These memory policies are
ultimately set by mbind() system call.

Memory policy could be 'hard coded' into the kernel, but none of
above policies fit our requirment under this case. mbind() support
default memory policy, but it requires a NULL nodemask. So obviously
setting allowed memory nodes is cgroups' mission under this case.
So we introduce a new option for mode in numatune named 'restrictive'.

<numatune>
   <memory mode="restrictive" nodeset="1-4,^3"/>
   <memnode cellid="0" mode="restrictive" nodeset="1"/>
   <memnode cellid="2" mode="restrictive" nodeset="2"/>
</numatune>

The config above means we only use cgroups to restrict the allowed
memory nodes and not setting any specific memory policies explicitly.

RFC discussion:
https://www.redhat.com/archives/libvir-list/2020-November/msg01256.html

Regards,
Luyao

Luyao Zhong (3):
  docs: add docs for 'restrictive' option for mode in numatune
  schema: add 'restrictive' config option for mode in numatune
  qemu: add parser and formatter for 'restrictive' mode in numatune

 docs/formatdomain.rst                         |  7 +++-
 docs/schemas/domaincommon.rng                 |  2 +
 include/libvirt/libvirt-domain.h              |  1 +
 src/conf/numa_conf.c                          |  9 +++++
 src/qemu/qemu_command.c                       |  6 ++-
 src/qemu/qemu_process.c                       | 27 +++++++++++++
 src/util/virnuma.c                            |  3 ++
 .../numatune-memnode-invalid-mode.err         |  1 +
 .../numatune-memnode-invalid-mode.xml         | 33 +++++++++++++++
 ...emnode-restrictive-mode.x86_64-latest.args | 40 +++++++++++++++++++
 .../numatune-memnode-restrictive-mode.xml     | 33 +++++++++++++++
 tests/qemuxml2argvtest.c                      |  2 +
 ...memnode-restrictive-mode.x86_64-latest.xml | 40 +++++++++++++++++++
 tests/qemuxml2xmltest.c                       |  1 +
 14 files changed, 202 insertions(+), 3 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/numatune-memnode-invalid-mode.err
 create mode 100644 tests/qemuxml2argvdata/numatune-memnode-invalid-mode.xml
 create mode 100644 
tests/qemuxml2argvdata/numatune-memnode-restrictive-mode.x86_64-latest.args
 create mode 100644 tests/qemuxml2argvdata/numatune-memnode-restrictive-mode.xml
 create mode 100644 
tests/qemuxml2xmloutdata/numatune-memnode-restrictive-mode.x86_64-latest.xml

-- 
2.25.4

Reply via email to