How /proc/interrupts gets updated?

0x90 picture 0x90 · Mar 5, 2013 · Viewed 8.9k times · Source

I would like to know how /proc/interrupts is getting up to date?

is it have only irq of drivers were probed or it contains the list of all the possible irqs in the system?

Answer

krase picture krase · Mar 5, 2013

As you can see in the source of the kernel, it displays all possible irqs of the system.
In source/fs/proc/interrupts.c:39 a sequence operation is initialized to return as many elements as interrupts exist in the system for /proc/interrupts.

In source/kernel/irq/proc.c:479 we can see that the counters of every interrupt gets extracted from global counters via kstat_irqs_cpu(irq, cpu).
This means the interrupt count information gets updated in different counters, one for each cpu. The counters get summed upon reading the proc file. This is a common pattern in the kernel. It prevents contention on a global counter.

More onfo about per-cpu variables you can read here. More about interrupts in linux you can get here.