Skip to content

Instantly share code, notes, and snippets.

@meteozond
Last active December 23, 2015 23:39
Show Gist options
  • Save meteozond/6711756 to your computer and use it in GitHub Desktop.
Save meteozond/6711756 to your computer and use it in GitHub Desktop.
By default all interrupts of multi interrupts network cards are linked to the first core. This script will uniformly spread interrupts between cores.
#!/bin/bash
cores=$(grep -c proc /proc/cpuinfo);
irqs=$(grep eth /proc/interrupts | cut -d: -f1)
core=$(($cores-1));
for irq in $irqs; do
mask=`echo "obase=16; \$[2 ** $core]" | bc`;
mkdir -p "/proc/irq/$irq/"
echo $core, $irq
echo $mask > /proc/irq/$irq/smp_affinity
core=$(($core-1));
if [ $core -eq -1 ];
then
core=$(($cores-1));
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment