[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240515100632.1419-1-ahuang12@lenovo.com>
Date: Wed, 15 May 2024 18:06:32 +0800
From: Adrian Huang <adrianhuang0701@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
Adrian Huang <ahuang12@...ovo.com>,
Jiwei Sun <sunjw10@...ovo.com>
Subject: [PATCH v2 2/2] genirq/proc: Refine percpu kstat_irqs access logic
From: Adrian Huang <ahuang12@...ovo.com>
Interrupts which have no action and chained interrupts can be
ignored due to the following reasons (as per tglx's comment):
1) Interrupts which have no action are completely uninteresting as
there is no real information attached.
2) Chained interrupts do not have a count at all.
Refine the condition statement, and convert the access of kstat_irqs
into the unconditional statement.
Suggested-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/lkml/87h6f0knau.ffs@tglx/
Tested-by: Jiwei Sun <sunjw10@...ovo.com>
Signed-off-by: Adrian Huang <ahuang12@...ovo.com>
---
kernel/irq/proc.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 623b8136e9af..e3d03103522c 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -461,10 +461,10 @@ int show_interrupts(struct seq_file *p, void *v)
{
static int prec;
- unsigned long flags, any_count = 0;
int i = *(loff_t *) v, j;
struct irqaction *action;
struct irq_desc *desc;
+ unsigned long flags;
if (i > ACTUAL_NR_IRQS)
return 0;
@@ -488,18 +488,12 @@ int show_interrupts(struct seq_file *p, void *v)
if (!desc || irq_settings_is_hidden(desc))
goto outsparse;
- if (desc->kstat_irqs) {
- for_each_online_cpu(j)
- any_count |= data_race(*per_cpu_ptr(desc->kstat_irqs, j));
- }
-
- if ((!desc->action || irq_desc_is_chained(desc)) && !any_count)
+ if (!desc->action || irq_desc_is_chained(desc) || !desc->kstat_irqs)
goto outsparse;
seq_printf(p, "%*d: ", prec, i);
for_each_online_cpu(j)
- seq_printf(p, "%10u ", desc->kstat_irqs ?
- *per_cpu_ptr(desc->kstat_irqs, j) : 0);
+ seq_printf(p, "%10u ", *per_cpu_ptr(desc->kstat_irqs, j));
raw_spin_lock_irqsave(&desc->lock, flags);
if (desc->irq_data.chip) {
--
2.25.1
Powered by blists - more mailing lists