-my sub get_cpuunits {
- my ($conf) = @_;
- 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
- } else {
- $cpuunits = 2 if $cpuunits < 2; # v2 can be lower, so clamp v1 there
- }
- return $cpuunits;
-}
-