From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757920Ab3BFSwT (ORCPT ); Wed, 6 Feb 2013 13:52:19 -0500 Received: from mail-da0-f46.google.com ([209.85.210.46]:63824 "EHLO mail-da0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757862Ab3BFSwS (ORCPT ); Wed, 6 Feb 2013 13:52:18 -0500 Date: Wed, 6 Feb 2013 10:52:13 -0800 From: Tejun Heo To: Hillf Danton Cc: Rusty Russell , Andrew Morton , Ingo Molnar , LKML Subject: Re: [PATCH 3/3] stop_machine: wake up stopper thread lazily Message-ID: <20130206185213.GC2875@htj.dyndns.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > > --- 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