genirq: Avoid summation loops for /proc/interrupts
authorBitao Hu <yaoma@linux.alibaba.com>
Thu, 11 Apr 2024 07:41:32 +0000 (15:41 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 12 Apr 2024 15:08:05 +0000 (17:08 +0200)
commit25a4a015118037809c97d089d69e927737e589e1
tree08f068eb3cdf341741c41672ee78adcfcbfef726
parent99cf63c56661be0a0c42f79b56f37a4aa34b4779
genirq: Avoid summation loops for /proc/interrupts

show_interrupts() unconditionally accumulates the per CPU interrupt
statistics to determine whether an interrupt was ever raised.

This can be avoided for all interrupts which are not strictly per CPU
and not of type NMI because those interrupts provide already an
accumulated counter. The required logic is already implemented in
kstat_irqs().

Split the inner access logic out of kstat_irqs() and use it for
kstat_irqs() and show_interrupts() to avoid the accumulation loop
when possible.

Originally-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Bitao Hu <yaoma@linux.alibaba.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Liu Song <liusong@linux.alibaba.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20240411074134.30922-4-yaoma@linux.alibaba.com
kernel/irq/internals.h
kernel/irq/irqdesc.c
kernel/irq/proc.c