Forked from pavel-odintsov/irq_balance_habrahabr.sh
Created
October 24, 2016 13:05
-
-
Save jedisct1/a396740f9377c7ad985db8083f37acaf to your computer and use it in GitHub Desktop.
irq_balance_habrahabr.sh
This file contains 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 | |
# from http://habrahabr.ru/post/108240/ | |
ncpus=`grep -ciw ^processor /proc/cpuinfo` | |
test "$ncpus" -gt 1 || exit 1 | |
n=0 | |
for irq in `cat /proc/interrupts | grep eth | 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=`printf %x $[2 ** $cpu]` | |
echo "Assign SMP affinity: eth queue $n, irq $irq, cpu $cpu, mask 0x$mask" | |
echo "$mask" > "$f" | |
let n+=1 | |
fi | |
done |
$ printf '%02x %02x %02x %02x' "$[2 ** 0]" "$[2 ** 1]" "$[2 ** 2]" "$[2 ** 3]"
01 02 04 08
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ cat /proc/irq/*/smp_affinityff
0f
0f
0f
0f
0f
0f
0c
$ echo$[2 ** 0] $ [2 ** 1] $[2 ** 2] $ [2 ** 3]
1 2 4 8