mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-06-22 18:37:56 +00:00
cpu units: handle clamping more centrally
preparation for also clamping on hotplug and lower the minimum in the schema so that the full v2 range can be used. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
4d47a9f510
commit
f43d7f67bf
@ -3393,7 +3393,15 @@ sub query_understood_cpu_flags {
|
|||||||
|
|
||||||
my sub get_cpuunits {
|
my sub get_cpuunits {
|
||||||
my ($conf) = @_;
|
my ($conf) = @_;
|
||||||
return $conf->{cpuunits} // (PVE::CGroup::cgroup_mode() == 2 ? 100 : 1024);
|
my $is_cgroupv2 = PVE::CGroup::cgroup_mode() == 2;
|
||||||
|
|
||||||
|
my $cpuunits = $conf->{cpuunits};
|
||||||
|
return $is_cgroupv2 ? 100 : 1024 if !defined($cpuunits);
|
||||||
|
|
||||||
|
if ($is_cgroupv2) {
|
||||||
|
$cpuunits = 10000 if $cpuunits >= 10000; # v1 can be higher, so clamp v2 there
|
||||||
|
}
|
||||||
|
return $cpuunits;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Since commit 277d33454f77ec1d1e0bc04e37621e4dd2424b67 in pve-qemu, smm is not off by default
|
# Since commit 277d33454f77ec1d1e0bc04e37621e4dd2424b67 in pve-qemu, smm is not off by default
|
||||||
@ -5567,7 +5575,6 @@ sub vm_start_nolock {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (PVE::CGroup::cgroup_mode() == 2) {
|
if (PVE::CGroup::cgroup_mode() == 2) {
|
||||||
$cpuunits = 10000 if $cpuunits >= 10000; # else we get an error
|
|
||||||
$systemd_properties{CPUWeight} = $cpuunits;
|
$systemd_properties{CPUWeight} = $cpuunits;
|
||||||
} else {
|
} else {
|
||||||
$systemd_properties{CPUShares} = $cpuunits;
|
$systemd_properties{CPUShares} = $cpuunits;
|
||||||
|
Loading…
Reference in New Issue
Block a user