Received: by 10.213.65.68 with SMTP id h4csp17837imn; Mon, 19 Mar 2018 18:03:35 -0700 (PDT) X-Google-Smtp-Source: AG47ELsl+J3QeFWl3FYuB/gejQhp3JxioNN3Zous3UAW63Uyt8aPfqKhqRDGL/WW7MXYGjuP5oo7 X-Received: by 10.101.64.67 with SMTP id h3mr10344402pgp.200.1521507815013; Mon, 19 Mar 2018 18:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521507814; cv=none; d=google.com; s=arc-20160816; b=uDtMDU8hrC6vgEJEkrGvc8qtHtK5I3YpOz7K5TImkOdkm8MfpZ86ykxVX18cyg5FjY ly9glwG0043j5DbvtW20bnaJYC9SgmlSXqN5CBnSgdFItsBUtql3X6vZ2nIF99thobve hsj0hmesR52NPgA58BHkS6/WdcPOCebNHuhfi4hgBUScjiJoGMELXbxpAv7jGu5eExAQ SZ2qxszjLCsTs5uA1xCOnWvearp2JSebGycWla2/Sx2q2zgjv5zxM6V0050o4uCPa64h eBqqkbKZtyNl9YfCOvvF5PjDlZWQVD2IQiquFUSp6VE50AAfaQcFRIBiykYBYyu6wMGf mn+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=1/dJlXnpYaree5c2bKFIHbs7zOw5nhXY7t47fjSIa/s=; b=h1hEFxGTS0eqYkRZgXz0KFe9a4VVbcapyxa+36B2DkZervuzvX0VkWrWjZu1cGLCGk hctw9BP2WcTN8YbbujW/1pgiEI89gCvecccGuOM5dmE0o6KnmoP+hJNQGlKHqTW80w9N PoOrLb8+bfoh14wTCwvZTLKsQsBOAekTnJHpPMZ97oKWq+IGSU8brR3xWLOysDR6eZ3p nKDvd0B+1KmgTl7lzeNSzNmsk/a57vGHe9hgXVDvQAlnGJrhx9wiTlAogQxddF5fpmRd vRd3FoQYekgr2+Nc2L4a1NHBpWCp1dkkeg83LepcbfYN0zG/lh7Pbo4LCReJfI1QBJuC fhrw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si377355pfk.106.2018.03.19.18.03.21; Mon, 19 Mar 2018 18:03:34 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970384AbeCSSgJ (ORCPT + 99 others); Mon, 19 Mar 2018 14:36:09 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51458 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S970365AbeCSSgF (ORCPT ); Mon, 19 Mar 2018 14:36:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CB94F7705E; Mon, 19 Mar 2018 18:36:04 +0000 (UTC) Received: from jlaw-desktop.bos.com (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98B3A6352E; Mon, 19 Mar 2018 18:36:04 +0000 (UTC) From: Joe Lawrence To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra Subject: [PATCH 2/2] sched/debug: adjust newlines for better alignment Date: Mon, 19 Mar 2018 14:35:55 -0400 Message-Id: <1521484555-8620-3-git-send-email-joe.lawrence@redhat.com> In-Reply-To: <1521484555-8620-1-git-send-email-joe.lawrence@redhat.com> References: <1521484555-8620-1-git-send-email-joe.lawrence@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 19 Mar 2018 18:36:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Mon, 19 Mar 2018 18:36:04 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'joe.lawrence@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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)) -- 1.8.3.1