Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp613082ybb; Wed, 8 Apr 2020 06:34:45 -0700 (PDT) X-Google-Smtp-Source: APiQypKeUbjbKySjOTakqjBsO8kQgNs+uCSVaqzvcsjvg87eU2gTOb4xKvTwPbaARKFVdJUicimT X-Received: by 2002:a4a:d21e:: with SMTP id c30mr6055537oos.0.1586352885800; Wed, 08 Apr 2020 06:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586352885; cv=none; d=google.com; s=arc-20160816; b=tsKdF2T1bfxACeBfFFKurjxdQW8rtHqaU29Bxao0UqITbwp66SfLW0U89sV+kcrz/X FHv4JKuicnkAmBjGQrwDQK138gXuRkxs4JXpuYWFRZ+g3Wh5iHbf6fa5iG96drT6q1ta yatoe2ZdG0cEyanzVdiLVN5Ff5wTTkoBaFvL1Wk/gnITKzO01V/kuL2JEm1gRX9SBdbB 11UeV85KutMQug9diRllcbVXm7FG8gVXyahkZOVUCswE8zaidqrlHuc4+4djDlE/wkPj Wdt4ngy4eUfCF+JQQH8JxazEUH3FUQTBU/x62mT1CJtS/7zM9FT9m++EMSm0ufzEbdMy Xj6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=bJM1uyIdbaNjrEC4Vbex3ahlXEFRO9ZEMudAbsCO6ew=; b=hJw8z5Ao4z+isd2pZJuqGGuLrVbzSI6Hu638j74bfXezjFdRSxmoUOua7u7WGuvkIZ jJ4P7HKNOMp4SpLBg/TAs6mcyMdwaZhEN0hm5zqyMWezZWaGo+vTDSimTTn4p3ypPLDV HDr2EJwBwHh3QF/BN9j0Bh3j++U8rdiGfiryUtt9dPmPv32HVT/pEeHwWCtgKTu85jUB jlceO4+GUZ+6l8N5vPbLaY9bm6BaBRDlWZXK5I5C7WqGv2Jf534zd7uzle5PMSnAWmje 5nLgvxM0GXlvKoQWnJRD91Ynm7BpWGvO5kDVju6Vpe3JyS5mMVVJptNSQWkiWISDEmmW 7Ycw== 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 r6si2483836oti.159.2020.04.08.06.34.30; Wed, 08 Apr 2020 06:34:45 -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 S1727913AbgDHMVP (ORCPT + 99 others); Wed, 8 Apr 2020 08:21:15 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:49636 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727666AbgDHMU3 (ORCPT ); Wed, 8 Apr 2020 08:20:29 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jM9gu-00063W-D7; Wed, 08 Apr 2020 14:20:24 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id F00AD1C0131; Wed, 8 Apr 2020 14:20:23 +0200 (CEST) Date: Wed, 08 Apr 2020 12:20:23 -0000 From: "tip-bot2 for Valentin Schneider" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/debug: Factor out printing formats into common macros Cc: Qais Yousef , Valentin Schneider , "Peter Zijlstra (Intel)" , Ingo Molnar , x86 , LKML In-Reply-To: <20200226124543.31986-3-valentin.schneider@arm.com> References: <20200226124543.31986-3-valentin.schneider@arm.com> MIME-Version: 1.0 Message-ID: <158634842347.28353.13932771277221700536.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/urgent branch of tip: Commit-ID: 9e3bf9469c29f7e4e49c5c0d8fecaf8ac57d1fe4 Gitweb: https://git.kernel.org/tip/9e3bf9469c29f7e4e49c5c0d8fecaf8ac57d1fe4 Author: Valentin Schneider AuthorDate: Wed, 26 Feb 2020 12:45:42 Committer: Ingo Molnar CommitterDate: Wed, 08 Apr 2020 11:35:26 +02:00 sched/debug: Factor out printing formats into common macros The printing macros in debug.c keep redefining the same output format. Collect each output format in a single definition, and reuse that definition in the other macros. While at it, add a layer of parentheses and replace printf's with the newly introduced macros. Reviewed-by: Qais Yousef Signed-off-by: Valentin Schneider Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lkml.kernel.org/r/20200226124543.31986-3-valentin.schneider@arm.com --- kernel/sched/debug.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 4670151..315ef6d 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -816,10 +816,12 @@ static int __init init_sched_debug_procfs(void) __initcall(init_sched_debug_procfs); -#define __P(F) SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)F) -#define P(F) SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)p->F) -#define __PN(F) SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)F)) -#define PN(F) SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) +#define __PS(S, F) SEQ_printf(m, "%-45s:%21Ld\n", S, (long long)(F)) +#define __P(F) __PS(#F, F) +#define P(F) __PS(#F, p->F) +#define __PSN(S, F) SEQ_printf(m, "%-45s:%14Ld.%06ld\n", S, SPLIT_NS((long long)(F))) +#define __PN(F) __PSN(#F, F) +#define PN(F) __PSN(#F, p->F) #ifdef CONFIG_NUMA_BALANCING @@ -868,10 +870,9 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns, SEQ_printf(m, "---------------------------------------------------------" "----------\n"); -#define P_SCHEDSTAT(F) \ - SEQ_printf(m, "%-45s:%21Ld\n", #F, (long long)schedstat_val(p->F)) -#define PN_SCHEDSTAT(F) \ - SEQ_printf(m, "%-45s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)schedstat_val(p->F))) + +#define P_SCHEDSTAT(F) __PS(#F, schedstat_val(p->F)) +#define PN_SCHEDSTAT(F) __PSN(#F, schedstat_val(p->F)) PN(se.exec_start); PN(se.vruntime); @@ -931,10 +932,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns, } __P(nr_switches); - SEQ_printf(m, "%-45s:%21Ld\n", - "nr_voluntary_switches", (long long)p->nvcsw); - SEQ_printf(m, "%-45s:%21Ld\n", - "nr_involuntary_switches", (long long)p->nivcsw); + __PS("nr_voluntary_switches", p->nvcsw); + __PS("nr_involuntary_switches", p->nivcsw); P(se.load.weight); #ifdef CONFIG_SMP @@ -963,8 +962,7 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns, t0 = cpu_clock(this_cpu); t1 = cpu_clock(this_cpu); - SEQ_printf(m, "%-45s:%21Ld\n", - "clock-delta", (long long)(t1-t0)); + __PS("clock-delta", t1-t0); } sched_show_numa(p, m);