Created
June 15, 2015 16:15
-
-
Save jschaub30/d9e98bd7cd8b6af6b98b to your computer and use it in GitHub Desktop.
Bash script to set network interrupts in Ubuntu linux
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 | |
[[ $# -lt 1 ]] && echo "Usage: $0 [INTERFACE] [RESET]" && exit 1 | |
IFACE=$1 | |
# Tweak the CPUSTART to fit your system | |
CPUSTART=32 | |
[[ $IFACE == "eth2" ]] && CPUSTART=8 | |
[[ $IFACE == "eth3" ]] && CPUSTART=16 | |
[[ $IFACE == "eth4" ]] && CPUSTART=24 | |
THREAD=0 | |
cat /proc/interrupts | grep "$IFACE-" | cut -d':' -f1 > tmp.interfaces | |
for IRQ in $(cat tmp.interfaces) | |
do | |
if [[ $2 == 'RESET' ]] | |
then | |
CMD="echo '0-159' > /proc/irq/$IRQ/smp_affinity_list" | |
else | |
CPU=$(( CPUSTART + THREAD )) | |
CMD="echo $CPU > /proc/irq/$IRQ/smp_affinity_list" | |
fi | |
echo sudo bash -c "$CMD" | |
sudo bash -c "$CMD" | |
THREAD=$(($THREAD+1)) | |
done | |
./read_interrupts.sh $IFACE # see https://gist.github.com/jschaub30/9f9d9f54d3ee6f53d2b3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment