]> www.infradead.org Git - nvme.git/commitdiff
sh: irq: Use seq_put_decimal_ull_width() for decimal values
authorDavid Wang <00107082@163.com>
Sat, 30 Nov 2024 13:49:09 +0000 (21:49 +0800)
committerJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Sat, 1 Feb 2025 09:42:36 +0000 (10:42 +0100)
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>
arch/sh/kernel/irq.c

index 4e6835de54cf8e773bd2b5b53df29e6ce7d2aa88..9022d8af9d686d24914808d0799bffa0b22be8e8 100644 (file)
@@ -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));