[pve-devel] [PATCH 2/4] cpuset: replace 'kind' with an 'effective' boolean

w.bumiller at proxmox.com w.bumiller at proxmox.com
Mon Mar 30 16:30:33 CEST 2020


From: Wolfgang Bumiller <w.bumiller at 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.bumiller at 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





More information about the pve-devel mailing list