From b3848f246cee22e6029c5afe5df10bec17a7e13d Mon Sep 17 00:00:00 2001 From: Alexander Zeidler Date: Tue, 16 Jan 2024 14:22:40 +0100 Subject: [PATCH] qm: resource limits: revise section affinity * mention side effects * increase compactness w/o complexity * improve section-formatting Signed-off-by: Alexander Zeidler --- qm.adoc | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/qm.adoc b/qm.adoc index 580d8db..86762d3 100644 --- a/qm.adoc +++ b/qm.adoc @@ -380,20 +380,24 @@ For more information see `man systemd.resource-control`, here `CPUQuota` corresponds to `cpulimit` and `CPUWeight` to our `cpuunits` setting. Visit its Notes section for references and implementation details. -The third CPU resource limiting setting, *affinity*, controls what host cores -the virtual machine will be permitted to execute on. E.g., if an affinity value -of `0-3,8-11` is provided, the virtual machine will be restricted to using the -host cores `0,1,2,3,8,9,10,` and `11`. Valid *affinity* values are written in -cpuset `List Format`. List Format is a comma-separated list of CPU numbers and -ranges of numbers, in ASCII decimal. - -NOTE: CPU *affinity* uses the `taskset` command to restrict virtual machines to -a given set of cores. This restriction will not take effect for some types of -processes that may be created for IO. *CPU affinity is not a security feature.* - -For more information regarding *affinity* see `man cpuset`. Here the -`List Format` corresponds to valid *affinity* values. Visit its `Formats` -section for more examples. +*affinity* + +With the *affinity* option you can specify the physical CPU cores which are +used to run the VM's vCPUs. Periphal VM processes, such as those for I/O, are +not affected by this setting. Note that the *CPU affinity is not a security +feature*. + +Forcing a CPU *affinity* can make sense in certain cases, but is accompanied by +an increase in complexity and maintenance effort. For example, if you want to +add more VMs later or migrate VMs to nodes with fewer CPU cores. It can also +easily lead to asynchronous and therefore limited system performance if some +CPUs are fully utilized while others are almost idle. + +The *affinity* is set by calling `taskset`. It accepts the host CPU numbers +(see `lscpu`) in the `List Format` from `man cpuset`. This ASCII decimal list +can contain numbers but also number ranges. E.g., the *affinity* `0-1,8-11` (or +alternatively `0,1,8,9,10,11`) only allow the VM to run on these six host +cores. CPU Type ^^^^^^^^ -- 2.39.5