aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Lawrence <joe.lawrence@redhat.com>2018-03-19 14:35:55 -0400
committerIngo Molnar <mingo@kernel.org>2018-03-20 04:30:09 -0400
commite9ca267096674eadd1fd479279bcb58df1486049 (patch)
tree4a7c6a7ef1f2d339d271899a784c00ac05641c4e
parenta8c024cd9b9683d25ae1f459525dd2c6bec75e79 (diff)
sched/debug: Adjust newlines for better alignment
Scheduler debug stats include newlines that display out of alignment when prefixed by timestamps. For example, the dmesg utility: % echo t > /proc/sysrq-trigger % dmesg ... [ 83.124251] runnable tasks: S task PID tree-key switches prio wait-time sum-exec sum-sleep ----------------------------------------------------------------------------------------------------------- At the same time, some syslog utilities (like rsyslog by default) don't like the additional newlines control characters, saving lines like this to /var/log/messages: Mar 16 16:02:29 localhost kernel: #012runnable tasks:#012 S task PID tree-key ... ^^^^ ^^^^ Clean these up by moving newline characters to their own SEQ_printf invocation. This leaves the /proc/sched_debug unchanged, but brings the entire output into alignment when prefixed: % echo t > /proc/sysrq-trigger % dmesg ... [ 62.410368] runnable tasks: [ 62.410368] S task PID tree-key switches prio wait-time sum-exec sum-sleep [ 62.410369] ----------------------------------------------------------------------------------------------------------- [ 62.410369] I kworker/u12:0 5 1932.215593 332 120 0.000000 3.621252 0.000000 0 0 / and no escaped control characters from rsyslog in /var/log/messages: Mar 16 16:15:06 localhost kernel: runnable tasks: Mar 16 16:15:06 localhost kernel: S task PID tree-key ... Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1521484555-8620-3-git-send-email-joe.lawrence@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/sched/debug.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 50026aa2d81e..72c401b3b15c 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -501,12 +501,12 @@ static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
501{ 501{
502 struct task_struct *g, *p; 502 struct task_struct *g, *p;
503 503
504 SEQ_printf(m, 504 SEQ_printf(m, "\n");
505 "\nrunnable tasks:\n" 505 SEQ_printf(m, "runnable tasks:\n");
506 " S task PID tree-key switches prio" 506 SEQ_printf(m, " S task PID tree-key switches prio"
507 " wait-time sum-exec sum-sleep\n" 507 " wait-time sum-exec sum-sleep\n");
508 "-------------------------------------------------------" 508 SEQ_printf(m, "-------------------------------------------------------"
509 "----------------------------------------------------\n"); 509 "----------------------------------------------------\n");
510 510
511 rcu_read_lock(); 511 rcu_read_lock();
512 for_each_process_thread(g, p) { 512 for_each_process_thread(g, p) {
@@ -527,9 +527,11 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
527 unsigned long flags; 527 unsigned long flags;
528 528
529#ifdef CONFIG_FAIR_GROUP_SCHED 529#ifdef CONFIG_FAIR_GROUP_SCHED
530 SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, task_group_path(cfs_rq->tg)); 530 SEQ_printf(m, "\n");
531 SEQ_printf(m, "cfs_rq[%d]:%s\n", cpu, task_group_path(cfs_rq->tg));
531#else 532#else
532 SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu); 533 SEQ_printf(m, "\n");
534 SEQ_printf(m, "cfs_rq[%d]:\n", cpu);
533#endif 535#endif
534 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock", 536 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock",
535 SPLIT_NS(cfs_rq->exec_clock)); 537 SPLIT_NS(cfs_rq->exec_clock));
@@ -595,9 +597,11 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
595void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq) 597void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq)
596{ 598{
597#ifdef CONFIG_RT_GROUP_SCHED 599#ifdef CONFIG_RT_GROUP_SCHED
598 SEQ_printf(m, "\nrt_rq[%d]:%s\n", cpu, task_group_path(rt_rq->tg)); 600 SEQ_printf(m, "\n");
601 SEQ_printf(m, "rt_rq[%d]:%s\n", cpu, task_group_path(rt_rq->tg));
599#else 602#else
600 SEQ_printf(m, "\nrt_rq[%d]:\n", cpu); 603 SEQ_printf(m, "\n");
604 SEQ_printf(m, "rt_rq[%d]:\n", cpu);
601#endif 605#endif
602 606
603#define P(x) \ 607#define P(x) \
@@ -624,7 +628,8 @@ void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq)
624{ 628{
625 struct dl_bw *dl_bw; 629 struct dl_bw *dl_bw;
626 630
627 SEQ_printf(m, "\ndl_rq[%d]:\n", cpu); 631 SEQ_printf(m, "\n");
632 SEQ_printf(m, "dl_rq[%d]:\n", cpu);
628 633
629#define PU(x) \ 634#define PU(x) \
630 SEQ_printf(m, " .%-30s: %lu\n", #x, (unsigned long)(dl_rq->x)) 635 SEQ_printf(m, " .%-30s: %lu\n", #x, (unsigned long)(dl_rq->x))