How to ban hardware interrupts with IRQBALANCE_BANNED_CPUS on Ubuntu?

Solution 1:

You set IRQBALANCE_BANNED_CPUS in /etc/default/irqbalance. I found this by looking in /etc/init.d/irqbalance. But what are the valid values for that setting? From Red Hat's man page:

This is a hex mask without the leading '0x', on systems with large numbers of processors each group of eight hex digits is sepearated ba a comma ','. i.e. export IRQBALANCE_BANNED_CPUS=fc0 would prevent irqbalance from assigning irqs to the 7th-12th cpus (cpu6-cpu11) or export IRQBALANCE_BANNED_CPUS=ff000000,00000001 would prevent irqbalance from assigning irqs to the 1st (cpu0) and 57th-64th cpus (cpu56-cpu63).

The concept of a mask is explained on wikipedia. Read that, then come back. Let's break down Red Hat's first example. The number that is written as fc0 in hexadecimal is written as 111111000000 in binary. Scanning right to left (i.e. from the least significant bit to the most significant bit), there are six zeroes. This means the 1st-5th cpus (cpu0-cpu5) can be assigned interrupts. Then, there are six ones. This means that the 7th-12th cpus (cpu6-cpu11) will not be assigned interrupts.

It sounds like you want to allow cpu0 and cpu1 to receive interrupts but prevent cpu2, cpu3, cpu4, and cpu5 from being assigned interrupts. That means you need two zeroes and four ones, or 111100. This is 3C in hexadecimal. So, you'd create /etc/default/irqbalance with the contents

ENABLED="1"
ONESHOT="0"
IRQBALANCE_BANNED_CPUS="3f"

To see what is going on, try

$ sudo service irqbalance stop
Stopping SMP IRQ Balancer: irqbalance.
$ source /etc/default/irqbalance 
$ sudo irqbalance --debug

Solution 2:

an irqbalance bug prevents IRQBALANCE_BANNED_CPUS from working on NUMA machinges: http://code.google.com/p/irqbalance/issues/detail?id=43

As of now, 1.0.5 is the latest irqbalance release and does not have the fix.