[PATCH] Update cpu.weight default to match documented default

Matt Corallo lpxdfsfs at mattcorallo.com
Tue Aug 16 05:49:48 CEST 2022


Proxmox documentation describes the default CPU weight as 1024 in
numerous places. However, when unset, the Linux default CGROUP
weight is 100.

This simply always writes an `lxc.cgroup2.cpu.weight` option to the
LXC config file, defaulting to 1024 instead of omitting the option
entirely.

Signed-off-by: Matt Corallo <git at bluematt.me>
---
  src/PVE/LXC.pm | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index fe63087..ca453a9 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -712,6 +712,9 @@ sub update_lxc_config {
  	    die "cpu weight (shares) must be in range [1, 10000]\n"
  		if $shares < 1 || $shares > 10000;
  	    $raw .= "lxc.cgroup2.cpu.weight = $shares\n";
+	} else {
+	    # Default as documented
+	    $raw .= "lxc.cgroup2.cpu.weight = 1024\n";
  	}
      }

-- 
2.35.1




More information about the pve-devel mailing list