* [PATCH v2] kernel/sched/core: Print the time when the process entered the D state
@ 2021-07-09 11:54 zhouchuangao
2021-07-09 13:06 ` Peter Zijlstra
0 siblings, 1 reply; 2+ messages in thread
From: zhouchuangao @ 2021-07-09 11:54 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 judge the state of the system and for debugging.
Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
---
kernel/sched/core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index cf16f8f..ab422ab 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -8154,10 +8154,12 @@ 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",
free, task_pid_nr(p), ppid,
(unsigned long)task_thread_info(p)->flags);
-
+#ifdef CONFIG_SCHED_INFO
+ pr_cont(" sched:%llu\n", p->sched_info.last_arrival);
+#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 [flat|nested] 2+ messages in thread
* Re: [PATCH v2] kernel/sched/core: Print the time when the process entered the D state
2021-07-09 11:54 [PATCH v2] kernel/sched/core: Print the time when the process entered the D state zhouchuangao
@ 2021-07-09 13:06 ` Peter Zijlstra
0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2021-07-09 13:06 UTC (permalink / raw)
To: zhouchuangao
Cc: Ingo Molnar, Juri Lelli, Vincent Guittot, Dietmar Eggemann,
Steven Rostedt, Ben Segall, Mel Gorman,
Daniel Bristot de Oliveira, linux-kernel
On Fri, Jul 09, 2021 at 04:54:49AM -0700, zhouchuangao wrote:
> 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 judge the state of the system and for debugging.
>
> Signed-off-by: zhouchuangao <zhouchuangao@vivo.com>
> ---
> kernel/sched/core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index cf16f8f..ab422ab 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -8154,10 +8154,12 @@ 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",
> free, task_pid_nr(p), ppid,
> (unsigned long)task_thread_info(p)->flags);
> -
> +#ifdef CONFIG_SCHED_INFO
> + pr_cont(" sched:%llu\n", p->sched_info.last_arrival);
"sched:" isn't really descriptive here, is it?
> +#endif
Also, you lost the "\n" for SCHED_INFO=n.
Please, take more than 5 minutes to fix the issues and test your patch
before sending it again.
> print_worker_info(KERN_INFO, p);
> print_stop_info(KERN_INFO, p);
> show_stack(p, NULL, KERN_INFO);
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-09 13:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 11:54 [PATCH v2] kernel/sched/core: Print the time when the process entered the D state zhouchuangao
2021-07-09 13:06 ` Peter Zijlstra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®