How do I bind NIC interrupts to selected CPU?

Estimated Reading Time: 2 minutes

I read this interesting mailing thread few weeks back. I won’t be late to share this with open source enthusiast like you. Here goes the story:

nic2

I have a 4 Quad server, am trying to bind NIC eth0 interrupt(s) to CPU4 and CPU5. As of now, my eth0 is found bind to all the 8’s.
#grep eth0 /proc/interrupts | awk ‘{print $NF}’ | sort

eth0-0
eth0-1
eth0-2
eth0-3
eth0-4
eth0-5
eth0-6
eth0-7

How to move ahead?

Solution: Follow these steps to get it done.

As I am using Broadcom card(bnx2), I am going to run this command and reboot my machine.

Open the terminal:

echo “options bnx2 disable_msi=1” > /etc/modprobe.d/bnx2.conf

then reboot, after you’ll only see one irq for eth0.

Next, run this command:

echo cpumask > /proc/irq/IRQ-OF-ETH0-0/smp_affinity

I believe the mask for cpu4 is 10 and cpu5 is 20.
(don’t forget to disable irqbalance)

you can only bind the irqs for one nic to one core at a time.

or you could do something fancy/silly with isolcpus and….

isolcpus all but 4/5 so that all irqs will be scheduled on 4/5. this will
mean that the kernel can only schedule tasks on cpu4/5.

Hope it helps !!!
then use cpusets/taskset/tuna to move all the processes off cpu 4/5… and
you’ll have to use taskset/cpuset/tuna for every task to ensure its not
using cpu4/5

Clap