Skip to content

Commit 84b9749

Browse files
zq-david-wangtorvalds
authored andcommitted
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: David Wang <00107082@163.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ff7afae commit 84b9749

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/proc/softirqs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int show_softirqs(struct seq_file *p, void *v)
2020
for (i = 0; i < NR_SOFTIRQS; i++) {
2121
seq_printf(p, "%12s:", softirq_to_name[i]);
2222
for_each_possible_cpu(j)
23-
seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
23+
seq_put_decimal_ull_width(p, " ", kstat_softirqs_cpu(i, j), 10);
2424
seq_putc(p, '\n');
2525
}
2626
return 0;

0 commit comments

Comments
 (0)