From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C4E47C176F for ; Tue, 16 Jan 2024 14:23:21 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A822836BE5 for ; Tue, 16 Jan 2024 14:22:51 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 16 Jan 2024 14:22:50 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 7C5D74914E for ; Tue, 16 Jan 2024 14:22:50 +0100 (CET) From: Alexander Zeidler To: pve-devel@lists.proxmox.com Date: Tue, 16 Jan 2024 14:22:40 +0100 Message-Id: <20240116132240.132246-3-a.zeidler@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240116132240.132246-1-a.zeidler@proxmox.com> References: <20240116132240.132246-1-a.zeidler@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH docs 3/3] qm: resource limits: revise section affinity X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2024 13:23:21 -0000 * 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 15aa0fc..d92db75 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.2