public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: yu.c.chen@intel.com, akpm@linux-foundation.org,
	juri.lelli@redhat.com, mingo@redhat.com, peterz@infradead.org,
	vincent.guittot@linaro.org, linux-kernel@vger.kernel.org,
	zyhtheonly@gmail.com, zwp10758@gmail.com, zyhtheonly@yeah.net
Subject: Re: [PATCH v3] sched: print parent comm in sched_show_task()
Date: Tue, 28 Mar 2023 11:40:46 +0200	[thread overview]
Message-ID: <ZCK2HuorPgSwWZpw@alley> (raw)
In-Reply-To: <20230328034438.GA8421@didi-ThinkCentre-M930t-N000>

On Tue 2023-03-28 11:44:59, Tio Zhang wrote:
> Knowing who the parent is might be useful for debugging.
> For example, we can sometimes resolve kernel hung tasks by stopping
> the person who begins those hung tasks.
> With the parent's name printed in sched_show_task(),
> it might be helpful to let people know which "service" should be operated.
> Also, we move the parent info to a following new line.
> It would be better to solve the situation when the task
> is not alive and we could not get information about the parent.
> 
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -8865,14 +8864,19 @@ void sched_show_task(struct task_struct *p)
>  #ifdef CONFIG_DEBUG_STACK_USAGE
>  	free = stack_not_used(p);
>  #endif
> -	ppid = 0;
> +
> +	pr_cont(" stack:%-5lu pid:%-5d flags:0x%08lx\n",
> +		free, task_pid_nr(p), read_task_thread_flags(p));
> +
>  	rcu_read_lock();
> -	if (pid_alive(p))
> -		ppid = task_pid_nr(rcu_dereference(p->real_parent));
> +	if (pid_alive(p)) {
> +		struct task_struct *parent = rcu_dereference(p->real_parent);
> +
> +		pr_info("parent:%-15.15s ppid:%-6d", parent->comm, task_pid_nr(parent));

There is a missing new line delimiter "\n".

> +	} else {
> +		pr_info("parent:unknown         ppid:<NULL>\n");
> +	}
>  	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));
>  
>  	print_worker_info(KERN_INFO, p);
>  	print_stop_info(KERN_INFO, p);

Otherwise, it looks good. With the added new line delimiter:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

  reply	other threads:[~2023-03-28  9:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 11:06 [PATCH v2] sched: print parent comm in sched_show_task() Tio Zhang
2023-01-20 13:09 ` Petr Mladek
2023-01-31  8:10   ` [PATCH v2 2/2] " Tio Zhang
2023-02-09  9:45     ` 张元瀚 Tio Zhang
2023-02-09 16:21     ` Chen Yu
     [not found]       ` <CAEQmJ=igQ8J9Y+_dWE6yaaFXHC965Sw+RxywWNLD=4G=tj0_hw@mail.gmail.com>
     [not found]         ` <CAEQmJ=iEC1G4MVRG=0XLWrCxqX_3E-6X-XbPeg8ti7oFjTBLBQ@mail.gmail.com>
2023-03-27 11:43           ` [RESEND][PATCH " Petr Mladek
2023-03-28  3:44             ` [PATCH v3] " Tio Zhang
2023-03-28  9:40               ` Petr Mladek [this message]
2023-06-02  5:44                 ` [PATCH v3 2/2] " Tio Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZCK2HuorPgSwWZpw@alley \
    --to=pmladek@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=yu.c.chen@intel.com \
    --cc=zwp10758@gmail.com \
    --cc=zyhtheonly@gmail.com \
    --cc=zyhtheonly@yeah.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox