[pve-devel] [PATCH 4/4] cpuset: cgroupv2 support

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


From: Wolfgang Bumiller <w.bumiller at proxmox.com>

Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
 src/PVE/CpuSet.pm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/PVE/CpuSet.pm b/src/PVE/CpuSet.pm
index 1f41e8f..297e995 100644
--- a/src/PVE/CpuSet.pm
+++ b/src/PVE/CpuSet.pm
@@ -25,9 +25,17 @@ sub new_from_cgroup {
 sub new_from_path {
     my ($class, $path, $effective) = @_;
 
-    my $kind = $effective ? 'effective_cpus' : 'cpus';
+    my $filename;
+    if ($effective) {
+	$filename = "$path/cpuset.effective_cpus";
+	if (!-e $filename) {
+	    # cgroupv2:
+	    $filename = "$path/cpuset.cpus.effective";
+	}
+    } else {
+	$filename = "$path/cpuset.cpus";
+    }
 
-    my $filename = "$path/cpuset.$kind";
     my $set_text = PVE::Tools::file_read_firstline($filename) // '';
 
     my ($count, $members) = parse_cpuset($set_text);
-- 
2.20.1





More information about the pve-devel mailing list