[PATCH 3/3] kernel-sched: Combine two seq_printf() calls into one in show_schedstat()

From: SF Markus Elfring
Date: Sat May 06 2017 - 15:44:52 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 6 May 2017 21:26:19 +0200

Some data were put into a sequence by two separate function calls.
Print the same data by a single function call instead.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
kernel/sched/stats.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c
index 87e2c9f0c33e..05ee4b6dcfca 100644
--- a/kernel/sched/stats.c
+++ b/kernel/sched/stats.c
@@ -30,15 +30,11 @@ static int show_schedstat(struct seq_file *seq, void *v)

/* runqueue-specific stats */
seq_printf(seq,
- "cpu%d %u 0 %u %u %u %u %llu %llu %lu",
- cpu, rq->yld_count,
- rq->sched_count, rq->sched_goidle,
- rq->ttwu_count, rq->ttwu_local,
- rq->rq_cpu_time,
- rq->rq_sched_info.run_delay, rq->rq_sched_info.pcount);
-
- seq_printf(seq, "\n");
-
+ "cpu%d %u 0 %u %u %u %u %llu %llu %lu\n",
+ cpu, rq->yld_count, rq->sched_count,
+ rq->sched_goidle, rq->ttwu_count, rq->ttwu_local,
+ rq->rq_cpu_time, rq->rq_sched_info.run_delay,
+ rq->rq_sched_info.pcount);
#ifdef CONFIG_SMP
/* domain-specific stats */
rcu_read_lock();
--
2.12.2