* [PATCH qemu-server v2 0/3] memory: add verbose_description to NUMA policy
@ 2026-03-12 14:54 Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 1/3] " Maximiliano Sandoval
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Maximiliano Sandoval @ 2026-03-12 14:54 UTC (permalink / raw)
To: pve-devel
Adds a more flavorful description to the NUMA policy option based on
both qemu and the kernel's documentation. For now we simply paste the
contents of the `qemu-system-x86_64(1)` manual.
One open question is if there is any precedent for URIs in verbose
descriptions.
This came up in a couple of cases in enterprise support where
information was requested regarding the NUMA policy.
Regarding the 'default' value. NUMA policies were added on our side at
2ed5d5724 but there is no mention of why the 'default' policy is not
used as a default. On QEMU's side the first appearance of policies was a
2.1.0 (Aug 2014) and there was a 'default' value at that stage.
While one could use the 'default' policy when the property is not set, I
personally would prefer if "not setting the key in the config" can be
represented by an explicit value in the config.
What was tested:
- Create a VM with 2048 MiB of ram and 1 CPU with numa enabled
- Ran:
- qm set 100 --numa0 cpus=0,memory=2048,hostnodes=0
- qm set 100 --numa0 cpus=0,memory=2048,hostnodes=0,policy=default
- qm set 100 --numa0 cpus=0,memory=2048,hostnodes=0,policy=bind
- Verify in each case that the memory-backend-ram has the right policy
in the qm showcmd 100 output
Differences from v1:
- Add more to the commit messages
- sed s/numa/NUMA
- Read default value from the schema directly
- Sneak a commit fixing the unit in a comment
- Say what was tested in cover letter
- Explain why a default value was added to the schema instead of just
using it instead of dying in the cover letter
Maximiliano Sandoval (3):
memory: add verbose_description to NUMA policy
memory: add default NUMA allocation policy
memory: fix unit in heuristic comment
src/PVE/QemuServer/Memory.pm | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH qemu-server v2 1/3] memory: add verbose_description to NUMA policy
2026-03-12 14:54 [PATCH qemu-server v2 0/3] memory: add verbose_description to NUMA policy Maximiliano Sandoval
@ 2026-03-12 14:54 ` Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 2/3] memory: add default NUMA allocation policy Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 3/3] memory: fix unit in heuristic comment Maximiliano Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Maximiliano Sandoval @ 2026-03-12 14:54 UTC (permalink / raw)
To: pve-devel
Based on the documentation for memory-backend-file at the
qemu-system-x86_64(1) manual.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
src/PVE/QemuServer/Memory.pm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/PVE/QemuServer/Memory.pm b/src/PVE/QemuServer/Memory.pm
index 7ebfc545..bcf6f9c5 100644
--- a/src/PVE/QemuServer/Memory.pm
+++ b/src/PVE/QemuServer/Memory.pm
@@ -42,6 +42,16 @@ my $numa_fmt = {
type => 'string',
enum => [qw(preferred bind interleave)],
description => "NUMA allocation policy.",
+ verbose_description => <<EODESC,
+NUMA allocation policy. Possible values are:
+
+ - preferred: prefer the given host node list for allocation
+ - bind: restrict memory allocation to the given host node list
+ - interleave: interleave memory allocations across the given host node list
+
+The models are explained in more details at the kernel's documentation
+https://docs.kernel.org/admin-guide/mm/numa_memory_policy.html#components-of-memory-policies.
+EODESC
optional => 1,
},
};
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH qemu-server v2 2/3] memory: add default NUMA allocation policy
2026-03-12 14:54 [PATCH qemu-server v2 0/3] memory: add verbose_description to NUMA policy Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 1/3] " Maximiliano Sandoval
@ 2026-03-12 14:54 ` Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 3/3] memory: fix unit in heuristic comment Maximiliano Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Maximiliano Sandoval @ 2026-03-12 14:54 UTC (permalink / raw)
To: pve-devel
This follows the host NUMA policy. This is the default policy in QEMU,
see
https://www.qemu.org/docs/master/interop/qemu-qmp-ref.html#object-QMP-qom.MemoryBackendProperties.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
src/PVE/QemuServer/Memory.pm | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/PVE/QemuServer/Memory.pm b/src/PVE/QemuServer/Memory.pm
index bcf6f9c5..f21b0b8d 100644
--- a/src/PVE/QemuServer/Memory.pm
+++ b/src/PVE/QemuServer/Memory.pm
@@ -40,11 +40,12 @@ my $numa_fmt = {
},
policy => {
type => 'string',
- enum => [qw(preferred bind interleave)],
+ enum => [qw(default preferred bind interleave)],
description => "NUMA allocation policy.",
verbose_description => <<EODESC,
NUMA allocation policy. Possible values are:
+ - default: default host policy
- preferred: prefer the given host node list for allocation
- bind: restrict memory allocation to the given host node list
- interleave: interleave memory allocations across the given host node list
@@ -53,6 +54,7 @@ The models are explained in more details at the kernel's documentation
https://docs.kernel.org/admin-guide/mm/numa_memory_policy.html#components-of-memory-policies.
EODESC
optional => 1,
+ default => 'default',
},
};
PVE::JSONSchema::register_format('pve-qm-numanode', $numa_fmt);
@@ -450,8 +452,7 @@ sub config {
my $hostnodes = print_numa_hostnodes($hostnodelists);
# policy
- my $policy = $numa->{policy};
- die "you need to define a policy for hostnode $hostnodes\n" if !$policy;
+ my $policy = $numa->{policy} // $numa_fmt->{policy}->{default};
$mem_object .= ",host-nodes=$hostnodes,policy=$policy";
} else {
die "numa hostnodes need to be defined to use hugepages" if $conf->{hugepages};
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH qemu-server v2 3/3] memory: fix unit in heuristic comment
2026-03-12 14:54 [PATCH qemu-server v2 0/3] memory: add verbose_description to NUMA policy Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 1/3] " Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 2/3] memory: add default NUMA allocation policy Maximiliano Sandoval
@ 2026-03-12 14:54 ` Maximiliano Sandoval
2 siblings, 0 replies; 4+ messages in thread
From: Maximiliano Sandoval @ 2026-03-12 14:54 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
src/PVE/QemuServer/Memory.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/PVE/QemuServer/Memory.pm b/src/PVE/QemuServer/Memory.pm
index f21b0b8d..4ccb89ea 100644
--- a/src/PVE/QemuServer/Memory.pm
+++ b/src/PVE/QemuServer/Memory.pm
@@ -151,7 +151,7 @@ my sub get_max_mem {
$bits = $bits & ~1; # round down to nearest even as limit is lower with odd bit sizes
- # heuristic: remove 20 bits to get MB and half that as QEMU needs some overhead
+ # heuristic: remove 20 bits to get MiB and half that as QEMU needs some overhead
my $bits_to_max_mem = int(1 << ($bits - 21));
return $bits_to_max_mem > 4 * 1024 * 1024 ? 4 * 1024 * 1024 : $bits_to_max_mem;
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-12 14:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-12 14:54 [PATCH qemu-server v2 0/3] memory: add verbose_description to NUMA policy Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 1/3] " Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 2/3] memory: add default NUMA allocation policy Maximiliano Sandoval
2026-03-12 14:54 ` [PATCH qemu-server v2 3/3] memory: fix unit in heuristic comment Maximiliano Sandoval
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox