Skip to content

Commit f9ed1f7

Browse files
zq-david-wangKAGA-KOKO
authored andcommitted
genirq/proc: Use seq_put_decimal_ull_width() for decimal values
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 <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 49a1763 commit f9ed1f7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

kernel/irq/proc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,12 @@ int show_interrupts(struct seq_file *p, void *v)
495495
if (!desc->action || irq_desc_is_chained(desc) || !desc->kstat_irqs)
496496
goto outsparse;
497497

498-
seq_printf(p, "%*d: ", prec, i);
499-
for_each_online_cpu(j)
500-
seq_printf(p, "%10u ", desc->kstat_irqs ? per_cpu(desc->kstat_irqs->cnt, j) : 0);
498+
seq_printf(p, "%*d:", prec, i);
499+
for_each_online_cpu(j) {
500+
unsigned int cnt = desc->kstat_irqs ? per_cpu(desc->kstat_irqs->cnt, j) : 0;
501+
502+
seq_put_decimal_ull_width(p, " ", cnt, 10);
503+
}
501504

502505
raw_spin_lock_irqsave(&desc->lock, flags);
503506
if (desc->irq_data.chip) {

0 commit comments

Comments
 (0)