[pve-devel] [PATCH common 1/2] cpuset: support non-continuous processor ids
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Apr 13 11:33:27 CEST 2017
This happens on some systems.
---
src/PVE/CpuSet.pm | 2 +-
src/PVE/ProcFSTools.pm | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/PVE/CpuSet.pm b/src/PVE/CpuSet.pm
index 9f76f38..24eb653 100644
--- a/src/PVE/CpuSet.pm
+++ b/src/PVE/CpuSet.pm
@@ -13,7 +13,7 @@ sub max_cpuid {
my $cpuinfo = PVE::ProcFSTools::read_cpuinfo();
- $MAX_CPUID = $cpuinfo->{cpus} || 1;
+ $MAX_CPUID = $cpuinfo->{max_cpuid} + 1;
return $MAX_CPUID;
}
diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index 05fd744..f79ff96 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -36,8 +36,10 @@ sub read_cpuinfo {
my $idhash = {};
my $count = 0;
+ my $maxid = 0;
while (defined(my $line = <$fh>)) {
- if ($line =~ m/^processor\s*:\s*\d+\s*$/i) {
+ if ($line =~ m/^processor\s*:\s*(\d+)\s*$/i) {
+ $maxid = $1 if $1 > $maxid;
$count++;
} elsif ($line =~ m/^model\s+name\s*:\s*(.*)\s*$/i) {
$res->{model} = $1 if $res->{model} eq 'unknown';
@@ -53,6 +55,7 @@ sub read_cpuinfo {
$res->{sockets} = scalar(keys %$idhash) || 1;
$res->{cpus} = $count;
+ $res->{max_cpuid} = $maxid;
$fh->close;
--
2.11.0
More information about the pve-devel
mailing list