Commit 84b9749a authored by David Wang's avatar David Wang Committed by Linus Torvalds
Browse files

proc/softirqs: replace seq_printf with seq_put_decimal_ull_width



seq_printf is costy, on a system with n CPUs, reading /proc/softirqs
would yield 10*n decimal values, and the extra cost parsing format string
grows linearly with number of cpus. Replace seq_printf with
seq_put_decimal_ull_width have significant performance improvement.
On an 8CPUs system, reading /proc/softirqs show ~40% performance
gain with this patch.

Signed-off-by: default avatarDavid Wang <00107082@163.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ff7afaec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ static int show_softirqs(struct seq_file *p, void *v)
	for (i = 0; i < NR_SOFTIRQS; i++) {
		seq_printf(p, "%12s:", softirq_to_name[i]);
		for_each_possible_cpu(j)
			seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
			seq_put_decimal_ull_width(p, " ", kstat_softirqs_cpu(i, j), 10);
		seq_putc(p, '\n');
	}
	return 0;