All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] stop_machine: wake up stopper thread lazily
@ 2013-02-06 12:40 Hillf Danton
  2013-02-06 18:52 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Hillf Danton @ 2013-02-06 12:40 UTC (permalink / raw)
  To: Rusty Russell, Tejun Heo; +Cc: Andrew Morton, Ingo Molnar, LKML, Hillf Danton

Ring no bell if the stopper thread is busy in handling enqueued works.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/kernel/stop_machine.c	Wed Feb  6 20:05:44 2013
+++ b/kernel/stop_machine.c	Wed Feb  6 20:06:56 2013
@@ -72,8 +72,10 @@ static void cpu_stop_queue_work(struct c
 	spin_lock_irqsave(&stopper->lock, flags);

 	if (stopper->enabled) {
+		int wakeup = list_empty(&stopper->works);
 		list_add_tail(&work->list, &stopper->works);
-		wake_up_process(stopper->thread);
+		if (wakeup)
+			wake_up_process(stopper->thread);
 	} else
 		cpu_stop_signal_done(work->done, false, 0);

--

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/3] stop_machine: wake up stopper thread lazily
  2013-02-06 12:40 [PATCH 3/3] stop_machine: wake up stopper thread lazily Hillf Danton
@ 2013-02-06 18:52 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2013-02-06 18:52 UTC (permalink / raw)
  To: Hillf Danton; +Cc: Rusty Russell, Andrew Morton, Ingo Molnar, LKML

On Wed, Feb 06, 2013 at 08:40:32PM +0800, Hillf Danton wrote:
> Ring no bell if the stopper thread is busy in handling enqueued works.
> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
> 
> --- a/kernel/stop_machine.c	Wed Feb  6 20:05:44 2013
> +++ b/kernel/stop_machine.c	Wed Feb  6 20:06:56 2013
> @@ -72,8 +72,10 @@ static void cpu_stop_queue_work(struct c
>  	spin_lock_irqsave(&stopper->lock, flags);
> 
>  	if (stopper->enabled) {
> +		int wakeup = list_empty(&stopper->works);
>  		list_add_tail(&work->list, &stopper->works);
> -		wake_up_process(stopper->thread);
> +		if (wakeup)
> +			wake_up_process(stopper->thread);

Why does this matter?  It shouldn't matter for correctness.  Is it
meant to be an optimization?  Is it something worth optimizing?  We
hardly ever have contention on cpu stoppers after all and we
shouldn't.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-06 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 12:40 [PATCH 3/3] stop_machine: wake up stopper thread lazily Hillf Danton
2013-02-06 18:52 ` Tejun Heo

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.