Skip to contentSkip to conversation

stats: Replace seq_printf with seq_puts

PATCH In review Xu Wang 2 participants 2 messages Sep 16, 2020 Scheduler

lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 stats: Replace seq_printf with seq_puts

seq_puts is a lot cheaper than seq_printf, so use that to print literal strings.

---
 kernel/sched/stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/stats.c +1 -1
index 750fb3c67eed..0818fe03407a 100644
@@ -37,7 +37,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
 		    rq->rq_cpu_time,
 		    rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount);
 
-		seq_printf(seq, "\n");
+		seq_putc(seq, '\n');
 
 #ifdef CONFIG_SMP
 		/* domain-specific stats */
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · Xu Wang

seq_puts is a lot cheaper than seq_printf, so use that to print literal strings.

performance is not a consideration here.

Quoted 10 lines
---
 kernel/sched/stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/stats.c +0 -0
index 750fb3c67eed..0818fe03407a 100644

kernel/sched/stats.c static int show_schedstat(struct seq_file *seq, void *v) · line 40

Quoted 5 lines
kernel/sched/stats.c +1 -1
@@ -37,7 +37,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
 		    rq->rq_cpu_time,
 		    rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount);
 
-		seq_printf(seq, "\n");
+		seq_putc(seq, '\n');

And yet, the changelog says seq_put*s*().

Quoted 6 lines
kernel/sched/stats.c +0 -0
 #ifdef CONFIG_SMP
 		/* domain-specific stats */
Signature · 1 line
2.17.1