linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched: Print each field value left-aligned in sched_show_task()
@ 2022-07-27  6:08 Zhen Lei
  2022-07-28  9:27 ` Valentin Schneider
  2022-08-02 19:50 ` [tip: sched/core] sched/debug: " tip-bot2 for Zhen Lei
  0 siblings, 2 replies; 3+ messages in thread
From: Zhen Lei @ 2022-07-27  6:08 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Valentin Schneider, linux-kernel
  Cc: Zhen Lei

Currently, the values of some fields are printed right-aligned, causing
the field value to be next to the next field name rather than next to its
own field name. So print each field value left-aligned, to make it more
readable.

Before:
	stack:    0 pid:  307 ppid:     2 flags:0x00000008
After
	stack:0     pid:308   ppid:2      flags:0x0000000a

This also makes them print in the same style as the other two fields:
	task:demo0           state:R  running task

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index da0bf6fe9ecdcf6..54e5fb2eeee898c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8792,7 +8792,7 @@ void sched_show_task(struct task_struct *p)
 	if (pid_alive(p))
 		ppid = task_pid_nr(rcu_dereference(p->real_parent));
 	rcu_read_unlock();
-	pr_cont(" stack:%5lu pid:%5d ppid:%6d flags:0x%08lx\n",
+	pr_cont(" stack:%-5lu pid:%-5d ppid:%-6d flags:0x%08lx\n",
 		free, task_pid_nr(p), ppid,
 		read_task_thread_flags(p));
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched: Print each field value left-aligned in sched_show_task()
  2022-07-27  6:08 [PATCH] sched: Print each field value left-aligned in sched_show_task() Zhen Lei
@ 2022-07-28  9:27 ` Valentin Schneider
  2022-08-02 19:50 ` [tip: sched/core] sched/debug: " tip-bot2 for Zhen Lei
  1 sibling, 0 replies; 3+ messages in thread
From: Valentin Schneider @ 2022-07-28  9:27 UTC (permalink / raw)
  To: Zhen Lei, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, linux-kernel
  Cc: Zhen Lei

On 27/07/22 14:08, Zhen Lei wrote:
> Currently, the values of some fields are printed right-aligned, causing
> the field value to be next to the next field name rather than next to its
> own field name. So print each field value left-aligned, to make it more
> readable.
>
> Before:
>       stack:    0 pid:  307 ppid:     2 flags:0x00000008
> After
>       stack:0     pid:308   ppid:2      flags:0x0000000a
>
> This also makes them print in the same style as the other two fields:
>       task:demo0           state:R  running task
>
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

Reviewed-by: Valentin Schneider <vschneid@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: sched/core] sched/debug: Print each field value left-aligned in sched_show_task()
  2022-07-27  6:08 [PATCH] sched: Print each field value left-aligned in sched_show_task() Zhen Lei
  2022-07-28  9:27 ` Valentin Schneider
@ 2022-08-02 19:50 ` tip-bot2 for Zhen Lei
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Zhen Lei @ 2022-08-02 19:50 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Zhen Lei, Ingo Molnar, Valentin Schneider, x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     0f03d6805bfc454279169a1460abb3f6b3db317f
Gitweb:        https://git.kernel.org/tip/0f03d6805bfc454279169a1460abb3f6b3db317f
Author:        Zhen Lei <thunder.leizhen@huawei.com>
AuthorDate:    Wed, 27 Jul 2022 14:08:19 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 02 Aug 2022 21:45:35 +02:00

sched/debug: Print each field value left-aligned in sched_show_task()

Currently, the values of some fields are printed right-aligned, causing
the field value to be next to the next field name rather than next to its
own field name. So print each field value left-aligned, to make it more
readable.

 Before:
	stack:    0 pid:  307 ppid:     2 flags:0x00000008
 After:
	stack:0     pid:308   ppid:2      flags:0x0000000a

This also makes them print in the same style as the other two fields:

	task:demo0           state:R  running task

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Valentin Schneider <vschneid@redhat.com>
Link: https://lore.kernel.org/r/20220727060819.1085-1-thunder.leizhen@huawei.com
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5555e49..6785e3b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8825,7 +8825,7 @@ void sched_show_task(struct task_struct *p)
 	if (pid_alive(p))
 		ppid = task_pid_nr(rcu_dereference(p->real_parent));
 	rcu_read_unlock();
-	pr_cont(" stack:%5lu pid:%5d ppid:%6d flags:0x%08lx\n",
+	pr_cont(" stack:%-5lu pid:%-5d ppid:%-6d flags:0x%08lx\n",
 		free, task_pid_nr(p), ppid,
 		read_task_thread_flags(p));
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-02 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27  6:08 [PATCH] sched: Print each field value left-aligned in sched_show_task() Zhen Lei
2022-07-28  9:27 ` Valentin Schneider
2022-08-02 19:50 ` [tip: sched/core] sched/debug: " tip-bot2 for Zhen Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).