linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched: print fields name when do sched_show_task
@ 2020-08-13 10:48 Libing Zhou
  2020-08-13 19:11 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Libing Zhou @ 2020-08-13 10:48 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot
  Cc: linux-kernel, libing.zhou, dietmar.eggemann, rostedt, bsegall, mgorman

Current sysrq(t) output task fields name are not aligned with
actual task fields value, e.g.:

        kernel: sysrq: SysRq : Show State
        kernel:  task                        PC stack   pid father
        kernel: systemd         S12456     1      0 0x00000000
        kernel: Call Trace:
        kernel: ? __schedule+0x240/0x740

To make it more readable, print fields name together with task fields
value in same line, remove separate fields name print.

Signed-off-by: Libing Zhou <libing.zhou@nokia-sbell.com>
---
 kernel/sched/core.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e15543cb8481..0ad554cb0bbb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6069,10 +6069,10 @@ void sched_show_task(struct task_struct *p)
 	if (!try_get_task_stack(p))
 		return;
 
-	printk(KERN_INFO "%-15.15s %c", p->comm, task_state_to_char(p));
+	pr_info("task:%-15.15s state:%c", p->comm, task_state_to_char(p));
 
 	if (p->state == TASK_RUNNING)
-		printk(KERN_CONT "  running task    ");
+		pr_cont("  running task    ");
 #ifdef CONFIG_DEBUG_STACK_USAGE
 	free = stack_not_used(p);
 #endif
@@ -6081,8 +6081,8 @@ void sched_show_task(struct task_struct *p)
 	if (pid_alive(p))
 		ppid = task_pid_nr(rcu_dereference(p->real_parent));
 	rcu_read_unlock();
-	printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free,
-		task_pid_nr(p), ppid,
+	pr_cont(" stack:%5lu pid:%5d ppid:%6d flags:0x%08lx\n",
+		free, task_pid_nr(p), ppid,
 		(unsigned long)task_thread_info(p)->flags);
 
 	print_worker_info(KERN_INFO, p);
@@ -6117,13 +6117,6 @@ void show_state_filter(unsigned long state_filter)
 {
 	struct task_struct *g, *p;
 
-#if BITS_PER_LONG == 32
-	printk(KERN_INFO
-		"  task                PC stack   pid father\n");
-#else
-	printk(KERN_INFO
-		"  task                        PC stack   pid father\n");
-#endif
 	rcu_read_lock();
 	for_each_process_thread(g, p) {
 		/*
-- 
2.22.0


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

* Re: [PATCH] sched: print fields name when do sched_show_task
  2020-08-13 10:48 [PATCH] sched: print fields name when do sched_show_task Libing Zhou
@ 2020-08-13 19:11 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2020-08-13 19:11 UTC (permalink / raw)
  To: Libing Zhou
  Cc: mingo, peterz, juri.lelli, vincent.guittot, linux-kernel,
	dietmar.eggemann, rostedt, bsegall, mgorman


* Libing Zhou <libing.zhou@nokia-sbell.com> wrote:

> Current sysrq(t) output task fields name are not aligned with
> actual task fields value, e.g.:
> 
>         kernel: sysrq: SysRq : Show State
>         kernel:  task                        PC stack   pid father
>         kernel: systemd         S12456     1      0 0x00000000
>         kernel: Call Trace:
>         kernel: ? __schedule+0x240/0x740
> 
> To make it more readable, print fields name together with task fields
> value in same line, remove separate fields name print.

Makes sense in principle, but could you please quote the new format as 
well in the changelog, not just the old format? Makes it much easier 
to compare.

Thanks,

	Ingo

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

end of thread, other threads:[~2020-08-13 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 10:48 [PATCH] sched: print fields name when do sched_show_task Libing Zhou
2020-08-13 19:11 ` Ingo Molnar

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).