From c1eb2494559fb0f6ee2beecaedb2a415ff096056 Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Thu, 3 Feb 2011 00:06:08 -0800 Subject: Bugfix 6773: Spread load of single-queue NICs across all CPUs. The initial CPU selection function needs to take hyperthreading into account. --- scripts/system/irq-affinity.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/system/irq-affinity.pl b/scripts/system/irq-affinity.pl index fec90dc3..cf68c0d1 100755 --- a/scripts/system/irq-affinity.pl +++ b/scripts/system/irq-affinity.pl @@ -157,7 +157,11 @@ sub first_cpu { unless defined($ifunit); my $threads = threads_per_core(); - return ( $ifunit * $threads ) % $cpus; + # Give the load first to one CPU of each hyperthreaded core, then + # if there are enough NICs, give the load to the other CPU of + # each core. + my $ht_wrap = (($ifunit * $threads) / $cpus) % $threads; + return ((($ifunit * $threads) + $ht_wrap) % $cpus); } # Assignment for multi-queue NICs -- cgit v1.2.3