public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: akpm@linux-foundation.org, rientjes@google.com,
	dwysocha@redhat.com, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH 1/2] hung_task: split for_each_process_thread() into for_each_process() + __for_each_thread()
Date: Fri, 20 Mar 2015 16:55:10 +0000	[thread overview]
Message-ID: <20150320165510.GI6831@atomlin.usersys.redhat.com> (raw)
In-Reply-To: <20150317192521.GB32579@redhat.com>

On Tue 2015-03-17 20:25 +0100, Oleg Nesterov wrote:
> Preparation. Change the main loop in check_hung_uninterruptible_tasks()
> to use the nested for_each_process() + __for_each_thread() loops explicitly.
> Note that we use __for_each_thread(), not for_each_thread(). This way it
> is clear that the inner loop doesn't depend on 'g' after we read ->signal.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> ---
>  kernel/hung_task.c |   23 ++++++++++++++---------
>  1 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/kernel/hung_task.c b/kernel/hung_task.c
> index e0f90c2..4735b99 100644
> --- a/kernel/hung_task.c
> +++ b/kernel/hung_task.c
> @@ -169,17 +169,22 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
>  		return;
>  
>  	rcu_read_lock();
> -	for_each_process_thread(g, t) {
> -		if (!max_count--)
> -			goto unlock;
> -		if (!--batch_count) {
> -			batch_count = HUNG_TASK_BATCHING;
> -			if (!rcu_lock_break(g, t))
> +	for_each_process(g) {
> +		struct signal_struct *sig = g->signal;
> +
> +		__for_each_thread(sig, t) {
> +			if (!max_count--)
>  				goto unlock;
> +
> +			if (!--batch_count) {
> +				batch_count = HUNG_TASK_BATCHING;
> +				if (!rcu_lock_break(g, t))
> +					goto unlock;
> +			}
> +			/* use "==" to skip the TASK_KILLABLE tasks */
> +			if (t->state == TASK_UNINTERRUPTIBLE)
> +				check_hung_task(t, timeout);
>  		}
> -		/* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */
> -		if (t->state == TASK_UNINTERRUPTIBLE)
> -			check_hung_task(t, timeout);
>  	}
>   unlock:
>  	rcu_read_unlock();
> 

Acked-by: Aaron Tomlin <atomlin@redhat.com>

  reply	other threads:[~2015-03-20 16:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 14:13 [PATCH 0/1] hung_task: Change hung_task.c to use for_each_process_thread() Aaron Tomlin
2015-03-17 14:13 ` [PATCH 1/1] " Aaron Tomlin
2015-03-17 17:09   ` Oleg Nesterov
2015-03-17 17:18     ` Aaron Tomlin
2015-03-17 19:24     ` [PATCH 0/2] hung_task: improve rcu_lock_break() logic Oleg Nesterov
2015-03-17 19:25       ` [PATCH 1/2] hung_task: split for_each_process_thread() into for_each_process() + __for_each_thread() Oleg Nesterov
2015-03-20 16:55         ` Aaron Tomlin [this message]
2015-03-17 19:25       ` [PATCH 2/2] hung_task: improve the rcu_lock_break() logic Oleg Nesterov
2015-03-20 16:55         ` Aaron Tomlin

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=20150320165510.GI6831@atomlin.usersys.redhat.com \
    --to=atomlin@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dwysocha@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rientjes@google.com \
    /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