Read /proc/interrupts and Set IRQ Affinity
Read each column of /proc/interrupts, find which CPU serves a device, and pin an IRQ to chosen CPUs with smp_affinity_list on Linux 6.12.

Your network card is saturating one CPU while seven others sit idle, and you want to know why. The answer is in a text file that most people never open. /proc/interrupts lists every interrupt source on the machine and how many times each CPU has served it, and a sibling directory lets you change which CPUs may serve a given one. This post shows how to read the file column by column, how to find the interrupts that matter, and how to pin an interrupt to a chosen CPU on Linux 6.12.
Reading the file
Run it with cat. Wide output is normal; the file has one column per CPU:
cat /proc/interrupts CPU0 CPU1 CPU2 CPU3
0: 10 0 0 0 IR-IO-APIC 2-edge timer
1: 0 0 1150 0 IR-IO-APIC 1-edge i8042
9: 0 0 0 301 IR-IO-APIC 9-fasteoi acpi
27: 0 881204 0 0 IR-PCI-MSIX-0000:00:1f.6 0-edge enp0s31f6
28: 455120 0 0 0 IR-PCI-MSIX-0000:00:17.0 0-edge ahci[0000:00:17.0]
NMI: 3 2 2 2 Non-maskable interrupts
LOC: 8120413 7993021 8201455 8012897 Local timer interrupts
RES: 41022 39884 40512 41077 Rescheduling interrupts
CAL: 90211 88045 91003 89914 Function call interrupts
TLB: 12044 11902 12118 12007 TLB shootdownsThe sample is illustrative; your rows and numbers differ. The layout is the same everywhere.
| Part | Meaning |
|---|---|
First column, 27: | The Linux IRQ number, a software identifier assigned by the kernel |
| One column per CPU | How many times that CPU has handled this interrupt since boot |
IR-PCI-MSIX-0000:00:1f.6 | The interrupt controller and the device that raises it |
0-edge or fasteoi | The hardware interrupt number and how the line signals |
| Last column | The name the driver gave when it registered, such as enp0s31f6 |
NMI, LOC, RES, CAL, TLB | Architecture-specific counters that have no Linux IRQ number |
Row 27 is a network card whose interrupts all land on CPU1: 881,204 there and zero elsewhere. That is the situation described above. If the card is busy, CPU1 does all the interrupt work.
The bottom rows are not devices. LOC is the local timer tick on each CPU, RES counts inter-processor wakeups asking a CPU to reschedule, and TLB counts requests to flush address-translation caches after memory mappings change. High RES or CAL counts on a busy server are normal. Rows shown only when nonzero or when the architecture defines them vary.
Finding the interrupt you care about
The device name is usually enough. To find the network interface, filter by its name, and to find storage, filter on the driver:
grep -E 'enp0s31f6|nvme|ahci' /proc/interrupts 27: 0 881204 0 0 IR-PCI-MSIX-0000:00:1f.6 0-edge enp0s31f6
28: 455120 0 0 0 IR-PCI-MSIX-0000:00:17.0 0-edge ahci[0000:00:17.0]Multi-queue devices appear as several rows with one name per queue (eth0-TxRx-0, nvme0q1), each normally pinned to its own CPU. A single row for a fast network card means the driver uses one interrupt, and all the work follows it to one CPU.
To see which CPUs are busy handling interrupts in real time, watch the counts change:
watch -d -n1 'grep enp0s31f6 /proc/interrupts'The -d flag highlights what changed between refreshes. With traffic running, the CPU1 count climbs and the others stay still.
Affinity: which CPUs may serve an interrupt
Each interrupt has a directory under /proc/irq/<number>/. The files that matter:
ls /proc/irq/27/affinity_hint effective_affinity effective_affinity_list enp0s31f6 node smp_affinity smp_affinity_list spurioussmp_affinity is a hexadecimal bit mask of allowed CPUs, with bit 0 for CPU0. smp_affinity_list is the same thing as a list or range, which is easier to read and write. effective_affinity_list is where the interrupt is delivered right now, which can be narrower than what you requested because the controller may support only one target. Compare them:
cat /proc/irq/27/smp_affinity_list /proc/irq/27/effective_affinity_list0-3
1Interrupt 27 is allowed on CPUs 0 to 3 but the hardware is delivering it to CPU1 only. On x86 with the APIC in the common mode, one target per interrupt is typical.
Changing it
Write a CPU list as root:
echo 2 | sudo tee /proc/irq/27/smp_affinity_list2Now new interrupts for line 27 go to CPU2. Re-read the counts after generating some traffic and the CPU2 column climbs while CPU1 stays fixed. Equivalent hex mask form: echo 4 > /proc/irq/27/smp_affinity, since 4 is binary 100, bit 2. A list is easier to get right and is what we recommend.
You can give several CPUs, echo 2-3, but with one interrupt line, many controllers will still deliver it to a single CPU from the list. To spread network load across CPUs, a multi-queue device (several rows) is the real answer, with each queue pinned to its own CPU.
Errors you may see:
echo 9 | sudo tee /proc/irq/27/smp_affinity_listtee: /proc/irq/27/smp_affinity_list: Invalid argumentEINVAL means the mask names no online CPU (this machine has CPUs 0 to 3), or the controller cannot honor that mask. Another case: managed interrupts, allocated by drivers such as NVMe with the affinity-spreading flag, are assigned by the kernel at allocation and cannot be changed from user space. Writing to them also fails with EIO or EINVAL, and /proc/irq/<n>/smp_affinity_list shows what the kernel chose.
The setting does not survive a reboot. Put it in a boot script, a systemd unit or a udev rule for devices that need it. There is also a global default for new interrupts in /proc/irq/default_smp_affinity.
The daemon that does it for you
Many distributions run irqbalance, a daemon that periodically reads /proc/interrupts and rewrites affinities to spread load. It is a reasonable default for servers with many devices. It also fights you: if you pin an interrupt by hand while irqbalance is running, it may move it again at its next interval. Either tell it to ignore the IRQ (the IRQBALANCE_BANNED_CPULIST setting and per-IRQ bans in /etc/default/irqbalance or its systemd environment file; check your distribution's name for it) or stop the service when you tune manually.
When pinning helps, and when it does not
Pinning an interrupt to the CPU running the application that consumes the data keeps the data in that CPU's cache, which reduces latency for network and storage paths. Pinning it away from the CPUs running a latency-critical thread keeps the interrupt from preempting it. Both depend on topology: CPUs sharing a cache or a NUMA node with the device are the right targets, and /proc/irq/<n>/node tells you which node the device is attached to.
Pinning does not help when one interrupt row is the bottleneck. A single-queue device sends everything through one CPU whichever CPU you pick. It also does not help when the real cost is in bottom halves: after the interrupt, the softirq work runs on the same CPU that took it, so a pinned interrupt moves the whole cost with it. Check with top or mpstat -P ALL 1 and look at %soft as well as %irq.
Verifying the effect
After changing affinity, measure instead of assuming. Read the CPU1 count (field 3 of the row, since field 1 is the IRQ number and field 2 is CPU0), wait, read it again and subtract:
before=$(awk '/enp0s31f6/ {print $3}' /proc/interrupts)
sleep 10
after=$(awk '/enp0s31f6/ {print $3}' /proc/interrupts)
echo "CPU1 delta: $((after - before))"CPU1 delta: 5342The number is an example and depends on traffic. Field numbers shift if your machine has a different CPU count only for later columns, so field 3 stays CPU1. A change in throughput or latency is what matters in the end, not the count itself.


