Skip to content

Instantly share code, notes, and snippets.

@denpamusic
Created April 12, 2019 09:08
Show Gist options
  • Save denpamusic/0a1c3b587a18aa955389a559c08663ad to your computer and use it in GitHub Desktop.
Save denpamusic/0a1c3b587a18aa955389a559c08663ad to your computer and use it in GitHub Desktop.
Balance interrupts across cpu cores on TP-Link Archer C2600 or similar
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
set_smp_affinity() {
local NR=0
local CPU=1
local ETHIRQS=`cat /proc/interrupts | grep "eth[0-9]" | cut -d: -f1`
local PCIIRQS=`cat /proc/interrupts | grep "qcom-pcie-msi" | cut -d: -f1`
local USBIRQS=`cat /proc/interrupts | grep "usb" | cut -d: -f1`
local IRQS="$ETHIRQS $PCIIRQS $USBIRQS"
for I in $IRQS; do
if [ `expr $NR % 2` -eq 0 ]; then
CPU=1
else
CPU=2
fi
echo $CPU > "/proc/irq/$I/smp_affinity"
NR=`expr $NR + 1`
done
}
set_smp_affinity
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment