linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/core: Prints the schedule time of the process
@ 2021-08-07  9:39 zhouchuangao
  0 siblings, 0 replies; only message in thread
From: zhouchuangao @ 2021-08-07  9:39 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, linux-kernel
  Cc: zhouchuangao

Sometimes we need to trigger /proc/sysrq-trigger to view the
information of the D state process in the system.
e.g:
echo w > /proc/sysrq-trigger

Here we print the scheduling time of the process, which is convenient
for us to debug.

Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
---
 kernel/sched/core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 014ce8b..916436d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8183,10 +8183,16 @@ void sched_show_task(struct task_struct *p)
 	if (pid_alive(p))
 		ppid = task_pid_nr(rcu_dereference(p->real_parent));
 	rcu_read_unlock();
+#ifdef CONFIG_SCHED_INFO
+	pr_cont(" stack:%5lu pid:%5d ppid:%6d flags:0x%08lx last-run:%llu\n",
+		free, task_pid_nr(p), ppid,
+		(unsigned long)task_thread_info(p)->flags,
+		p->sched_info.last_arrival);
+#else
 	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);
-
+#endif
 	print_worker_info(KERN_INFO, p);
 	print_stop_info(KERN_INFO, p);
 	show_stack(p, NULL, KERN_INFO);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-07  9:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-07  9:39 [PATCH] sched/core: Prints the schedule time of the process zhouchuangao

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