Forked from pavel-odintsov/irq_balance_habrahabr.sh
Last active
April 3, 2017 09:08
-
-
Save demofly/ec0b146a1b62611ac8c3 to your computer and use it in GitHub Desktop.
IRQ CPU affinity setter: network and RAID hardware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ncpus=`grep -ciw ^processor /proc/cpuinfo` | |
test "$ncpus" -gt 1 || exit 1 | |
n=0 | |
for irq in `cat /proc/interrupts | grep 'IR-PCI-MSI-edge' | awk '{print $1}' | sed s/\://g` | |
do | |
f="/proc/irq/$irq/smp_affinity" | |
test -r "$f" || continue | |
cpu=$[$ncpus - ($n % $ncpus) - 1] | |
if [ $cpu -ge 0 ] | |
then | |
mask=$(echo `printf %x $[2 ** $cpu]` | sed -r 's#(.)(.{8})$#\1,\2#g') | |
echo "Assign SMP affinity: eth queue $n, irq $irq, cpu $cpu, mask $mask" | |
echo "echo $mask > $f" | |
echo "$mask" > "$f" | |
let n+=1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what about
PCI-MSI-edge
?