cpu units: lower minimum for accessing full cgroupv2 range

also clamp that up in the v1 case for compat.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-02-11 09:29:50 +01:00
parent f43d7f67bf
commit e65e35ca6d

View File

@ -336,7 +336,7 @@ my $confdesc = {
verbose_description => "CPU weight for a VM. Argument is used in the kernel fair scheduler." verbose_description => "CPU weight for a VM. Argument is used in the kernel fair scheduler."
." The larger the number is, the more CPU time this VM gets. Number is relative to" ." The larger the number is, the more CPU time this VM gets. Number is relative to"
." weights of all the other running VMs.", ." weights of all the other running VMs.",
minimum => 2, minimum => 1,
maximum => 262144, maximum => 262144,
default => 'cgroup v1: 1024, cgroup v2: 100', default => 'cgroup v1: 1024, cgroup v2: 100',
}, },
@ -3400,6 +3400,8 @@ my sub get_cpuunits {
if ($is_cgroupv2) { if ($is_cgroupv2) {
$cpuunits = 10000 if $cpuunits >= 10000; # v1 can be higher, so clamp v2 there $cpuunits = 10000 if $cpuunits >= 10000; # v1 can be higher, so clamp v2 there
} else {
$cpuunits = 2 if $cpuunits < 2; # v2 can be lower, so clamp v1 there
} }
return $cpuunits; return $cpuunits;
} }