]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
genirq/proc: Use seq_put_decimal_ull_width() for decimal values
authorDavid Wang <00107082@163.com>
Fri, 8 Nov 2024 16:07:17 +0000 (00:07 +0800)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 13 Nov 2024 16:36:35 +0000 (17:36 +0100)
seq_printf() is more expensive than seq_put_decimal_ull_width() due to the
format string parsing costs.

Profiling on a x86 8-core system indicates seq_printf() takes ~47% samples
of show_interrupts(). Replacing it with seq_put_decimal_ull_width() yields
almost 30% performance gain.

[ tglx: Massaged changelog and fixed up coding style ]

Signed-off-by: David Wang <00107082@163.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20241108160717.9547-1-00107082@163.com
kernel/irq/proc.c

index d226282c5b66b728c48677f7631767b54885f1d8..f36c33bd2da46c6657639d680849b44031fcb502 100644 (file)
@@ -495,9 +495,12 @@ int show_interrupts(struct seq_file *p, void *v)
        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(desc->kstat_irqs->cnt, j) : 0);
+       seq_printf(p, "%*d:", prec, i);
+       for_each_online_cpu(j) {
+               unsigned int cnt = desc->kstat_irqs ? per_cpu(desc->kstat_irqs->cnt, j) : 0;
+
+               seq_put_decimal_ull_width(p, " ", cnt, 10);
+       }
 
        raw_spin_lock_irqsave(&desc->lock, flags);
        if (desc->irq_data.chip) {