From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753938Ab2ALPI1 (ORCPT ); Thu, 12 Jan 2012 10:08:27 -0500 Received: from casper.infradead.org ([85.118.1.10]:59535 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753703Ab2ALPIX convert rfc822-to-8bit (ORCPT ); Thu, 12 Jan 2012 10:08:23 -0500 Message-ID: <1326380884.2442.187.camel@twins> Subject: Re: [PATCH 2/2] mm: page allocator: Do not drain per-cpu lists via IPI from page allocator context From: Peter Zijlstra To: Gilad Ben-Yossef Cc: Mel Gorman , Linux-MM , Linux-FSDevel , LKML , Andrew Morton , "Srivatsa S. Bhat" , Russell King - ARM Linux , "Paul E. McKenney" , Miklos Szeredi , "Eric W. Biederman" , Greg KH , Gong Chen Date: Thu, 12 Jan 2012 16:08:04 +0100 In-Reply-To: References: <1326276668-19932-1-git-send-email-mgorman@suse.de> <1326276668-19932-3-git-send-email-mgorman@suse.de> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Mailer: Evolution 3.2.1- Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2012-01-12 at 16:51 +0200, Gilad Ben-Yossef wrote: > What I can't figure out is why we don't need get/put_online_cpus() > pair around each and every call > to on_each_cpu everywhere? and if we do, perhaps making it a part of > on_each_cpu is the way to go? > > Something like: > > diff --git a/kernel/smp.c b/kernel/smp.c > index f66a1b2..cfa3882 100644 > --- a/kernel/smp.c > +++ b/kernel/smp.c > @@ -691,11 +691,15 @@ void on_each_cpu(void (*func) (void *info), void > *info, int wait) > { > unsigned long flags; > > + BUG_ON(in_atomic()); > + > + get_online_cpus(); > preempt_disable(); Your preempt_disable() here serializes against hotplug.. > smp_call_function(func, info, wait); > local_irq_save(flags); > func(info); > local_irq_restore(flags); > preempt_enable(); > + put_online_cpus(); > } > EXPORT_SYMBOL(on_each_cpu);