All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Hillf Danton <dhillf@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] stop_machine: dequeue work before signal completion
Date: Wed, 6 Feb 2013 10:47:49 -0800	[thread overview]
Message-ID: <20130206184749.GB2875@htj.dyndns.org> (raw)
In-Reply-To: <CAJd=RBBsMaXS5hA1OCX8Sp2y90Crktp6p4a7MSRZ3p6xq6RCmg@mail.gmail.com>

On Wed, Feb 06, 2013 at 08:38:43PM +0800, Hillf Danton wrote:
> As handled by the kernel thread, work is dequeued first for further actions.

Ditto as the previous patch.

> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
> 
> --- a/kernel/stop_machine.c	Wed Feb  6 19:57:12 2013
> +++ b/kernel/stop_machine.c	Wed Feb  6 20:02:12 2013
> @@ -334,23 +334,24 @@ static int __cpuinit cpu_stop_cpu_callba
>  #ifdef CONFIG_HOTPLUG_CPU
>  	case CPU_UP_CANCELED:
>  	case CPU_POST_DEAD:
> -	{
> -		struct cpu_stop_work *work;
> -
>  		sched_set_stop_task(cpu, NULL);
>  		/* kill the stopper */
>  		kthread_stop(stopper->thread);
>  		/* drain remaining works */
>  		spin_lock_irq(&stopper->lock);
> -		list_for_each_entry(work, &stopper->works, list)
> +		while (!list_empty(&stopper->works)) {
> +			struct cpu_stop_work *work;
> +			work = list_first_entry(&stopper->works,
> +					struct cpu_stop_work, list);
> +			list_del_init(&work->list);
>  			cpu_stop_signal_done(work->done, false, 0);
> +		}
>  		stopper->enabled = false;
>  		spin_unlock_irq(&stopper->lock);

Why does this matter?  It's inside spinlock.  What's being made better
by this change?

-- 
tejun

  reply	other threads:[~2013-02-06 18:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06 12:38 [PATCH 2/3] stop_machine: dequeue work before signal completion Hillf Danton
2013-02-06 18:47 ` Tejun Heo [this message]
2013-02-07  2:21   ` Namhyung Kim
2013-02-07  2:29     ` Tejun Heo
2013-02-07 11:53       ` Hillf Danton

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=20130206184749.GB2875@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dhillf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.