From: Wolfgang Bumiller <w.bumil...@proxmox.com>

All of our users of this function currently either pass
'effective_cpus' or nothing (undef), and in cgroupv2 the
effective-cpuset file uses a different naming scheme.

Since this is only a distinction between "intended" and
"effective", use this as a boolean instead, for easier
future cgroupv2 support.

Signed-off-by: Wolfgang Bumiller <w.bumil...@proxmox.com>
---
 src/PVE/CpuSet.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/PVE/CpuSet.pm b/src/PVE/CpuSet.pm
index aab2c9a..fe36536 100644
--- a/src/PVE/CpuSet.pm
+++ b/src/PVE/CpuSet.pm
@@ -14,10 +14,11 @@ sub new {
     return $self;
 }
 
+# Create a new set with the contents of a cgroup-v1 subdirectory
 sub new_from_cgroup {
-    my ($class, $cgroup, $kind) = @_;
+    my ($class, $cgroup, $effective) = @_;
 
-    $kind //= 'cpus';
+    my $kind = $effective ? 'effective_cpus' : 'cpus';
 
     my $filename = "/sys/fs/cgroup/cpuset/$cgroup/cpuset.$kind";
     my $set_text = PVE::Tools::file_read_firstline($filename) // '';
-- 
2.20.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to