From: Wolfgang Bumiller Date: Mon, 30 Mar 2020 14:30:33 +0000 (+0200) Subject: cpuset: replace 'kind' with an 'effective' boolean X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=3e02302a64d194d8cc315d932102cb330992c656 cpuset: replace 'kind' with an 'effective' boolean 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 --- 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) // '';