diff options
author | David Wang <00107082@163.com> | 2024-11-06 05:12:28 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-12-05 15:52:41 +0300 |
commit | 48c8d9f0476bbb5c88ecdab73fc5b0238c28337b (patch) | |
tree | 82d91da9e1b11f2a2b9bb6fdd3ccf0e070aeba08 | |
parent | df194b7febfaa99e90e284ed9e2b52fd4114f285 (diff) | |
download | linux-48c8d9f0476bbb5c88ecdab73fc5b0238c28337b.tar.xz |
proc/softirqs: replace seq_printf with seq_put_decimal_ull_width
[ Upstream commit 84b9749a3a704dcc824a88aa8267247c801d51e4 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/proc/softirqs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/proc/softirqs.c b/fs/proc/softirqs.c index f4616083faef..04bb29721419 100644 --- a/fs/proc/softirqs.c +++ b/fs/proc/softirqs.c @@ -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; |