diff options
| author | Thomas Gleixner <tglx@kernel.org> | 2026-05-17 22:01:43 +0200 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-05-26 16:21:11 +0200 |
| commit | 0179464391af9a01b911f441d2dda42ea253dfbd (patch) | |
| tree | eb075916005f7d56ad39f47fcc57b26a973f0c31 /kernel/irq | |
| parent | 95c33a64f203be444954a1e1d855a4820c4f0efa (diff) | |
| download | lwn-0179464391af9a01b911f441d2dda42ea253dfbd.tar.gz lwn-0179464391af9a01b911f441d2dda42ea253dfbd.zip | |
genirq/proc: Utilize irq_desc::tot_count to avoid evaluation
Interrupts which are not marked per CPU increment not only the per CPU
statistics, but also the accumulation counter irq_desc::tot_count.
Change the counter to type unsigned long so it does not produce sporadic
zeros due to wrap arounds on 64-bit machines and do a quick check for non
per CPU interrupts. If the counter is zero, then simply emit a full set of
zero strings. That spares the evaluation of the per CPU counters completely
for interrupts with zero events.
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Dmitry Ilvokhin <d@ilvokhin.com>
Reviewed-by: Radu Rendec <radu@rendec.net>
Link: https://patch.msgid.link/20260517194931.115522199@kernel.org
Diffstat (limited to 'kernel/irq')
| -rw-r--r-- | kernel/irq/proc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index 378b523a1b00..5a1805b0b8a9 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -523,7 +523,16 @@ int show_interrupts(struct seq_file *p, void *v) return 0; seq_printf(p, "%*d:", prec, i); - irq_proc_emit_counts(p, &desc->kstat_irqs->cnt); + + /* + * Always output per CPU interrupts. Output device interrupts only when + * desc::tot_count is not zero. + */ + if (irq_settings_is_per_cpu(desc) || irq_settings_is_per_cpu_devid(desc) || + data_race(desc->tot_count)) + irq_proc_emit_counts(p, &desc->kstat_irqs->cnt); + else + irq_proc_emit_zero_counts(p, num_online_cpus()); seq_putc(p, ' '); guard(raw_spinlock_irq)(&desc->lock); |
