summaryrefslogtreecommitdiff
path: root/scripts/system
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2011-05-19 08:08:31 -0700
committerStephen Hemminger <shemminger@vyatta.com>2011-05-19 08:08:31 -0700
commit262ab1d763600bcbe3bed48ad1efb28c48fbf2d4 (patch)
tree548f26ca26a4fd9094dfae93599301e0a823e9dd /scripts/system
parent27ee0f241c05ba4b2e3fd1b7b6703c8427b71ea2 (diff)
downloadvyatta-cfg-system-262ab1d763600bcbe3bed48ad1efb28c48fbf2d4.tar.gz
vyatta-cfg-system-262ab1d763600bcbe3bed48ad1efb28c48fbf2d4.zip
irq-affinity: fix handling of UP system
On a UP system, there is no "physical-id" in /proc/cpuinfo.
Diffstat (limited to 'scripts/system')
-rwxr-xr-xscripts/system/irq-affinity.pl21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/system/irq-affinity.pl b/scripts/system/irq-affinity.pl
index f9894563..6112de3e 100755
--- a/scripts/system/irq-affinity.pl
+++ b/scripts/system/irq-affinity.pl
@@ -30,9 +30,7 @@ die "Error: Interface $ifname does not exist\n"
my $logopt = defined($debug) ? "perror" : "";
openlog("irq-affinity", $logopt, LOG_LOCAL0);
-my ( $cpus, $cores, $processors ) = cpuinfo();
-
-syslog(LOG_DEBUG, "cpus=%d cores=%d sockets=%d\n", $cpus, $cores, $processors);
+my ( $cpus, $cores ) = cpuinfo();
if ($mask eq 'auto') {
affinity_auto($ifname);
@@ -76,7 +74,8 @@ sub irqinfo {
# Determine number of cpus and cores
sub cpuinfo {
- my ( $cpu, $core, $packages );
+ my ( $cpus, $cores );
+ my $sockets = 0;
open( my $f, '<', "/proc/cpuinfo" )
or die "Can't read /proc/cpuinfo";
@@ -84,20 +83,22 @@ sub cpuinfo {
while (<$f>) {
chomp;
if (/^cpu cores\s+:\s(\d+)$/) {
- $core = $1;
+ $cores = $1;
}
elsif (/^processor\s+:\s+(\d+)$/) {
- $cpu = $1;
+ $cpus = $1 + 1;
}
elsif (/^physical id\s+:\s+(\d+)$/) {
- $packages = $1;
+ $sockets = $1 + 1;
}
}
close $f;
- $packages++;
- $core *= $packages;
- return ( $cpu + 1, $core, $packages );
+ syslog(LOG_DEBUG, "cpus=%d cores=%d sockets=%d\n",
+ $cpus, $cores, $sockets);
+
+ $cores *= $sockets;
+ return ( $cpus, $cores );
}
# Determine hyperthreading factor