sched/debug: Print 'tgid' in sched_show_task()
authorYajun Deng <yajun.deng@linux.dev>
Thu, 20 Jul 2023 08:05:16 +0000 (16:05 +0800)
committerIngo Molnar <mingo@kernel.org>
Sat, 7 Oct 2023 09:33:28 +0000 (11:33 +0200)
Multiple blocked tasks are printed when the system hangs. They may have
the same parent pid, but belong to different task groups.

Printing tgid lets users better know whether these tasks are from the same
task group or not.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230720080516.1515297-1-yajun.deng@linux.dev
kernel/sched/core.c

index f5783cb16791582ba47dbcb8c7e6bfc0479ec3df..cf6d3fdd4eb5a6c1eb609377cee7d9a29d37ea08 100644 (file)
@@ -9089,9 +9089,9 @@ 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",
-               free, task_pid_nr(p), ppid,
-               read_task_thread_flags(p));
+       pr_cont(" stack:%-5lu pid:%-5d tgid:%-5d ppid:%-6d flags:0x%08lx\n",
+               free, task_pid_nr(p), task_tgid_nr(p),
+               ppid, read_task_thread_flags(p));
 
        print_worker_info(KERN_INFO, p);
        print_stop_info(KERN_INFO, p);