]> git.proxmox.com Git - pve-common.git/commitdiff
cpuset: remove max-cpu range check
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 20 Apr 2017 08:35:52 +0000 (10:35 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 20 Apr 2017 08:35:54 +0000 (10:35 +0200)
CpuSets usually come from (or a built using) values read
from cgroups anyway. (Eg. for container balancing we only
use ids found in lxc/cpuset.effective_cpus.)

src/PVE/CpuSet.pm

index 9f76f385d27843282cc617167b751020d88539bd..eaa4e3cb48eccef29e314ee4e61955af421e55df 100644 (file)
@@ -5,28 +5,13 @@ use warnings;
 use PVE::Tools;
 use PVE::ProcFSTools;
 
 use PVE::Tools;
 use PVE::ProcFSTools;
 
-my $MAX_CPUID;
-
-sub max_cpuid {
-
-    return $MAX_CPUID if defined($MAX_CPUID);
-
-    my $cpuinfo = PVE::ProcFSTools::read_cpuinfo();
-
-    $MAX_CPUID = $cpuinfo->{cpus} || 1;
-
-    return $MAX_CPUID;
-}
-
 sub new {
     my ($this) = @_;
 
     my $class = ref($this) || $this;
 
     my $self = bless { members => {} }, $class;
 sub new {
     my ($this) = @_;
 
     my $class = ref($this) || $this;
 
     my $self = bless { members => {} }, $class;
-    
-    max_cpuid() if !defined($MAX_CPUID); # initialize $MAX_CPUID
-    
+
     return $self;
 }
 
     return $self;
 }
 
@@ -48,8 +33,6 @@ sub new_from_cgroup {
        if ($part =~ /^\s*(\d+)(?:-(\d+))?\s*$/) {
            my ($from, $to) = ($1, $2);
            $to //= $1;
        if ($part =~ /^\s*(\d+)(?:-(\d+))?\s*$/) {
            my ($from, $to) = ($1, $2);
            $to //= $1;
-           die "cpu id '$from' is out of range\n" if $from >= $MAX_CPUID;
-           die "cpu id '$to' is out of range\n" if $to >= $MAX_CPUID;
            die "invalid range: $part ($to < $from)\n" if $to < $from;
            for (my $i = $from; $i <= $to; $i++) {
                $members->{$i} = 1;
            die "invalid range: $part ($to < $from)\n" if $to < $from;
            for (my $i = $from; $i <= $to; $i++) {
                $members->{$i} = 1;
@@ -91,7 +74,6 @@ sub insert {
     my $count = 0;
     
     foreach my $cpu (@members) {
     my $count = 0;
     
     foreach my $cpu (@members) {
-       die "cpu id '$cpu' is out of range\n" if $cpu >= $MAX_CPUID;
        next if $self->{members}->{$cpu};
        $self->{members}->{$cpu} = 1;
        $count++;
        next if $self->{members}->{$cpu};
        $self->{members}->{$cpu} = 1;
        $count++;
@@ -106,7 +88,6 @@ sub delete {
     my $count = 0;
     
     foreach my $cpu (@members) {
     my $count = 0;
     
     foreach my $cpu (@members) {
-       die "cpu id '$cpu' is out of range\n" if $cpu >= $MAX_CPUID;
        next if !$self->{members}->{$cpu};
        delete $self->{members}->{$cpu};
        $count++;
        next if !$self->{members}->{$cpu};
        delete $self->{members}->{$cpu};
        $count++;