Received: by 10.213.65.68 with SMTP id h4csp314309imn; Tue, 20 Mar 2018 04:22:14 -0700 (PDT) X-Google-Smtp-Source: AG47ELs/1jlFaLNn6KrP036GCRlULxpT7KXE01N91jTZoCWi/kwXxyrCG86H3cn3wm1S+U3tRLaG X-Received: by 10.98.32.134 with SMTP id m6mr13408721pfj.27.1521544934217; Tue, 20 Mar 2018 04:22:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521544934; cv=none; d=google.com; s=arc-20160816; b=BPlzuPB23UZDRjS3W5n5Nnn1wuRVtp31NvU8+VRQ9AmL7zJhMle2XRAOMvS1BWkZur HUKDJu6YBbr4GcLZMUxPWVtsLYAOqjkdAWrOjckd4hdbaR9eE2uaoeBRvESi86goaR/N ZRoQAqq01ySHSyP9DT8c0I6ZZow+um0vrXTnMgFbR32w4/f7i/DgWTajXHQS4Yv8OEih dkmOf/T7N5do0y7vtAQ/YH5gF9VZkARurPS5TyIEyPYIgfM7+I9h6giJdKPAKk25LmIO S5PJk3eXxD1TQdbH0G3r6+EUCy9rb/L+2YYACwrbgMPKeGo7j13GKdPq3OBzyl4Fhsah 8FXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=SJw+tOXkF89vZfr87rBGdyna5UwUr4pLfnbZvUT4Ffg=; b=P0sksd4WtA/UgOI5j1NP/mOhOss3AjHomvdzpDib/KOZpppp+SLJT30+fT3QFM90ar tJt49md+LEljO+8mSgXXWFMcP/j3MxxsTsMqtSuqajjuxRJvfpqWhm4BGLbEYJkkYd0e Ud7gNM8hjSsuYmrzfgWoDE/f9GkBJkgs0KdeAJh8SehRbEHydgORXuPMLZ4XtjbfTn38 Bw9z70Qv0CBaqymaLBVxnX44VzGIs4QtUrAhVCvWc4Z4QgJ5KgFkiqP58kaZtkQACVal lTwhXtjOmF06E0CAu24TkIcebQxoCawjQvOO/xf0ZRQanlKuZFgCPTtD4AKkU6aS8LzS TULQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si975275pgj.705.2018.03.20.04.21.59; Tue, 20 Mar 2018 04:22:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753102AbeCTLTc (ORCPT + 99 others); Tue, 20 Mar 2018 07:19:32 -0400 Received: from terminus.zytor.com ([198.137.202.136]:46547 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752781AbeCTLT3 (ORCPT ); Tue, 20 Mar 2018 07:19:29 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2KBJ80q013970; Tue, 20 Mar 2018 04:19:08 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2KBJ8cD013967; Tue, 20 Mar 2018 04:19:08 -0700 Date: Tue, 20 Mar 2018 04:19:08 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Joe Lawrence Message-ID: Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, hpa@zytor.com, torvalds@linux-foundation.org, mingo@kernel.org, joe.lawrence@redhat.com Reply-To: linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, torvalds@linux-foundation.org, joe.lawrence@redhat.com, mingo@kernel.org, tglx@linutronix.de In-Reply-To: <1521484555-8620-3-git-send-email-joe.lawrence@redhat.com> References: <1521484555-8620-3-git-send-email-joe.lawrence@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/urgent] sched/debug: Adjust newlines for better alignment Git-Commit-ID: e9ca267096674eadd1fd479279bcb58df1486049 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e9ca267096674eadd1fd479279bcb58df1486049 Gitweb: https://git.kernel.org/tip/e9ca267096674eadd1fd479279bcb58df1486049 Author: Joe Lawrence AuthorDate: Mon, 19 Mar 2018 14:35:55 -0400 Committer: Ingo Molnar CommitDate: Tue, 20 Mar 2018 09:30:09 +0100 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 Acked-by: Peter Zijlstra Cc: Linus Torvalds Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1521484555-8620-3-git-send-email-joe.lawrence@redhat.com Signed-off-by: Ingo Molnar --- kernel/sched/debug.c | 27 ++++++++++++++++----------- 1 file 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) { struct task_struct *g, *p; - SEQ_printf(m, - "\nrunnable tasks:\n" - " S task PID tree-key switches prio" - " wait-time sum-exec sum-sleep\n" - "-------------------------------------------------------" - "----------------------------------------------------\n"); + SEQ_printf(m, "\n"); + SEQ_printf(m, "runnable tasks:\n"); + SEQ_printf(m, " S task PID tree-key switches prio" + " wait-time sum-exec sum-sleep\n"); + SEQ_printf(m, "-------------------------------------------------------" + "----------------------------------------------------\n"); rcu_read_lock(); 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) unsigned long flags; #ifdef CONFIG_FAIR_GROUP_SCHED - SEQ_printf(m, "\ncfs_rq[%d]:%s\n", cpu, task_group_path(cfs_rq->tg)); + SEQ_printf(m, "\n"); + SEQ_printf(m, "cfs_rq[%d]:%s\n", cpu, task_group_path(cfs_rq->tg)); #else - SEQ_printf(m, "\ncfs_rq[%d]:\n", cpu); + SEQ_printf(m, "\n"); + SEQ_printf(m, "cfs_rq[%d]:\n", cpu); #endif SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "exec_clock", 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) void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq) { #ifdef CONFIG_RT_GROUP_SCHED - SEQ_printf(m, "\nrt_rq[%d]:%s\n", cpu, task_group_path(rt_rq->tg)); + SEQ_printf(m, "\n"); + SEQ_printf(m, "rt_rq[%d]:%s\n", cpu, task_group_path(rt_rq->tg)); #else - SEQ_printf(m, "\nrt_rq[%d]:\n", cpu); + SEQ_printf(m, "\n"); + SEQ_printf(m, "rt_rq[%d]:\n", cpu); #endif #define P(x) \ @@ -624,7 +628,8 @@ void print_dl_rq(struct seq_file *m, int cpu, struct dl_rq *dl_rq) { struct dl_bw *dl_bw; - SEQ_printf(m, "\ndl_rq[%d]:\n", cpu); + SEQ_printf(m, "\n"); + SEQ_printf(m, "dl_rq[%d]:\n", cpu); #define PU(x) \ SEQ_printf(m, " .%-30s: %lu\n", #x, (unsigned long)(dl_rq->x))