]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/irq: Make irqstats array based
authorThomas Gleixner <tglx@kernel.org>
Sun, 17 May 2026 20:01:48 +0000 (22:01 +0200)
committerThomas Gleixner <tglx@kernel.org>
Tue, 26 May 2026 14:21:12 +0000 (16:21 +0200)
commit2b57c69917eeba3ee657f252257e37f31916ba2a
treed2f908cd6c890153b57d9ead9dcc8752b14a5909
parent0179464391af9a01b911f441d2dda42ea253dfbd
x86/irq: Make irqstats array based

Having the x86 specific interrupt statistics as a data structure with
individual members instead of an array is just stupid as it requires
endless copy and paste in arch_show_interrupts() and arch_irq_stat_cpu(),
where the latter does not even take the latest interrupt additions into
account. The resulting #ifdef orgy is just disgusting.

Convert it to an array of counters, which does not make a difference in the
actual interrupt hotpath increment as the array index is constant and
therefore not any different than the member based access.

But in arch_show_interrupts() and arch_irq_stat_cpu() this just turns into
a loop, which reduces the text size by ~2k (~12%):

   text    data     bss     dec     hex filename
  19643   15250     904   35797    8bd5 ../build/arch/x86/kernel/irq.o
  17355   15250     904   33509    82e5 ../build/arch/x86/kernel/irq.o

Adding a new vector or software counter only requires to update the table
and everything just works. Using the core provided emit function which
speeds up 0 outputs makes it significantly faster.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Radu Rendec <radu@rendec.net>
Link: https://patch.msgid.link/20260517194931.196070643@kernel.org
27 files changed:
arch/x86/events/amd/core.c
arch/x86/events/amd/ibs.c
arch/x86/events/core.c
arch/x86/events/intel/core.c
arch/x86/events/intel/knc.c
arch/x86/events/intel/p4.c
arch/x86/events/zhaoxin/core.c
arch/x86/hyperv/hv_init.c
arch/x86/include/asm/hardirq.h
arch/x86/include/asm/mce.h
arch/x86/kernel/apic/apic.c
arch/x86/kernel/apic/ipi.c
arch/x86/kernel/cpu/acrn.c
arch/x86/kernel/cpu/mce/amd.c
arch/x86/kernel/cpu/mce/core.c
arch/x86/kernel/cpu/mce/threshold.c
arch/x86/kernel/cpu/mshyperv.c
arch/x86/kernel/irq.c
arch/x86/kernel/irq_work.c
arch/x86/kernel/kvm.c
arch/x86/kernel/nmi.c
arch/x86/kernel/smp.c
arch/x86/mm/tlb.c
arch/x86/xen/enlighten_hvm.c
arch/x86/xen/enlighten_pv.c
arch/x86/xen/smp.c
arch/x86/xen/smp_pv.c