[pve-devel] [RFC common 1/1] change cpu shares: drop unused $cgroupv1_default parameter

Fiona Ebner f.ebner at proxmox.com
Fri Oct 7 14:41:51 CEST 2022


The only expression it appears in short-circuits, because the line
before ensures that $shares is guaranteed to be set.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

Before we can add a new parameter to the function again, it would need
a Breaks for qemu-server and pve-container. So maybe we prefer to just
leave it as is? cgroupv1 won't be around forever anyways.

 src/PVE/CGroup.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/CGroup.pm b/src/PVE/CGroup.pm
index 45c0788..ae929f0 100644
--- a/src/PVE/CGroup.pm
+++ b/src/PVE/CGroup.pm
@@ -500,7 +500,7 @@ sub change_cpu_quota {
 #
 # Dies on error (including a not-running or currently-shutting-down guest).
 sub change_cpu_shares {
-    my ($self, $shares, $cgroupv1_default) = @_;
+    my ($self, $shares) = @_;
 
     my ($path, $ver) = $self->get_path('cpu', 1);
     if (!defined($path)) {
@@ -512,7 +512,7 @@ sub change_cpu_shares {
 	PVE::ProcFSTools::write_proc_entry("$path/cpu.weight", $shares);
     } elsif ($ver == 1) {
 	$shares //= 1024;
-	PVE::ProcFSTools::write_proc_entry("$path/cpu.shares", $shares // $cgroupv1_default);
+	PVE::ProcFSTools::write_proc_entry("$path/cpu.shares", $shares);
     } else {
 	die "bad cgroup version: $ver\n";
     }
-- 
2.30.2






More information about the pve-devel mailing list