On 4/3/20 4:37 PM, w.bumil...@proxmox.com wrote: > ... > +# Change the cpu "shares" for a container. > +# > +# In cgroupv1 we used a value in `[0..500000]` with a default of 1024. > +# > +# In cgroupv2 we do not have "shares", we have "weights" in the range > +# of `[1..10000]` with a default of 100. > +# > +# Since the default values don't match when scaling linearly, we use the > +# values we get as-is and simply error for values >10000 in cgroupv2. > +# > +# It is left to the user to figure this out for now. > +# > +# Dies on error (including a not-running or currently-shutting-down guest). > +sub change_cpu_shares { > + my ($self, $shares, $cgroupv1_default) = @_; > + > + if (cgroup_mode() == 2) { > + if (defined(my $path = $self->get_path('cpu'))) { > + # the cgroupv2 documentation defines the default to 100 > + $shares //= 100; > + die "cpu weight (shares) must be in range [1, 10000]\n" if $shares > < 1 || $shares > 10000;
Wouldn't it be more sensible to existing setup when this just truncates those values which where valid for cgroupv1? I.e. >1000 -> 1000 and < 1 -> 1? _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel