Skip to content

Commit

Permalink
sh: irq: Use seq_put_decimal_ull_width() for decimal values
Browse files Browse the repository at this point in the history
On a system with n CPUs and m interrupts, there will be n*m decimal
values yielded via seq_printf(.."%10u "..) which has significant costs
parsing format string and is less efficient than seq_put_decimal_ull_width().
Stress reading /proc/interrupts indicates ~30% performance improvement with
this patch.

Signed-off-by: David Wang <00107082@163.com>
Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
  • Loading branch information
zq-david-wang authored and glaubitz committed Feb 1, 2025
1 parent 40384c8 commit d2a5f10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/sh/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ int arch_show_interrupts(struct seq_file *p, int prec)
{
int j;

seq_printf(p, "%*s: ", prec, "NMI");
seq_printf(p, "%*s:", prec, "NMI");
for_each_online_cpu(j)
seq_printf(p, "%10u ", per_cpu(irq_stat.__nmi_count, j));
seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat.__nmi_count, j), 10);
seq_printf(p, " Non-maskable interrupts\n");

seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count));
Expand Down

0 comments on commit d2a5f10

Please sign in to comment.