Skip to content

Commit cc172ff

Browse files
Libing ZhouIngo Molnar
authored andcommitted
sched/debug: Fix the alignment of the show-state debug output
Current sysrq(t) output task fields name are not aligned with actual task fields value, e.g.: kernel: 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 the same line, with fixed width: kernel: sysrq: Show State kernel: task:systemd state:S stack:12920 pid: 1 ppid: 0 flags:0x00000000 kernel: Call Trace: kernel: __schedule+0x282/0x620 Signed-off-by: Libing Zhou <libing.zhou@nokia-sbell.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20200814030236.37835-1-libing.zhou@nokia-sbell.com
1 parent a1bd068 commit cc172ff

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

kernel/sched/core.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6387,10 +6387,10 @@ void sched_show_task(struct task_struct *p)
63876387
if (!try_get_task_stack(p))
63886388
return;
63896389

6390-
printk(KERN_INFO "%-15.15s %c", p->comm, task_state_to_char(p));
6390+
pr_info("task:%-15.15s state:%c", p->comm, task_state_to_char(p));
63916391

63926392
if (p->state == TASK_RUNNING)
6393-
printk(KERN_CONT " running task ");
6393+
pr_cont(" running task ");
63946394
#ifdef CONFIG_DEBUG_STACK_USAGE
63956395
free = stack_not_used(p);
63966396
#endif
@@ -6399,8 +6399,8 @@ void sched_show_task(struct task_struct *p)
63996399
if (pid_alive(p))
64006400
ppid = task_pid_nr(rcu_dereference(p->real_parent));
64016401
rcu_read_unlock();
6402-
printk(KERN_CONT "%5lu %5d %6d 0x%08lx\n", free,
6403-
task_pid_nr(p), ppid,
6402+
pr_cont(" stack:%5lu pid:%5d ppid:%6d flags:0x%08lx\n",
6403+
free, task_pid_nr(p), ppid,
64046404
(unsigned long)task_thread_info(p)->flags);
64056405

64066406
print_worker_info(KERN_INFO, p);
@@ -6435,13 +6435,6 @@ void show_state_filter(unsigned long state_filter)
64356435
{
64366436
struct task_struct *g, *p;
64376437

6438-
#if BITS_PER_LONG == 32
6439-
printk(KERN_INFO
6440-
" task PC stack pid father\n");
6441-
#else
6442-
printk(KERN_INFO
6443-
" task PC stack pid father\n");
6444-
#endif
64456438
rcu_read_lock();
64466439
for_each_process_thread(g, p) {
64476440
/*

0 commit comments

Comments
 (0)