From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by kanga.kvack.org (Postfix) with ESMTP id 77F156B00C1 for ; Wed, 23 Nov 2011 02:45:12 -0500 (EST) Received: by vbbfn1 with SMTP id fn1so1302531vbb.14 for ; Tue, 22 Nov 2011 23:45:11 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1321960128-15191-6-git-send-email-gilad@benyossef.com> References: <1321960128-15191-1-git-send-email-gilad@benyossef.com> <1321960128-15191-6-git-send-email-gilad@benyossef.com> Date: Wed, 23 Nov 2011 09:45:10 +0200 Message-ID: Subject: Re: [PATCH v4 5/5] mm: Only IPI CPUs to drain local pages if they exist From: Pekka Enberg Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: owner-linux-mm@kvack.org List-ID: To: Gilad Ben-Yossef Cc: linux-kernel@vger.kernel.org, Chris Metcalf , Peter Zijlstra , Frederic Weisbecker , Russell King , linux-mm@kvack.org, Matt Mackall , Sasha Levin , Rik van Riel , Andi Kleen , Mel Gorman , Andrew Morton On Tue, Nov 22, 2011 at 1:08 PM, Gilad Ben-Yossef wro= te: > Calculate a cpumask of CPUs with per-cpu pages in any zone and only send = an IPI requesting CPUs to drain these pages to the buddy allocator if they = actually have pages when asked to flush. > > The code path of memory allocation failure for CPUMASK_OFFSTACK=3Dy confi= g was tested using fault injection framework. > > Signed-off-by: Gilad Ben-Yossef > Acked-by: Christoph Lameter > CC: Chris Metcalf > CC: Peter Zijlstra > CC: Frederic Weisbecker > CC: Russell King > CC: linux-mm@kvack.org > CC: Pekka Enberg > CC: Matt Mackall > CC: Sasha Levin > CC: Rik van Riel > CC: Andi Kleen I'm adding Mel and Andrew to CC. > --- > =A0mm/page_alloc.c | =A0 18 +++++++++++++++++- > =A01 files changed, 17 insertions(+), 1 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 9dd443d..a3efdf1 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1119,7 +1119,23 @@ void drain_local_pages(void *arg) > =A0*/ > =A0void drain_all_pages(void) > =A0{ > - =A0 =A0 =A0 on_each_cpu(drain_local_pages, NULL, 1); > + =A0 =A0 =A0 int cpu; > + =A0 =A0 =A0 struct zone *zone; > + =A0 =A0 =A0 cpumask_var_t cpus; > + =A0 =A0 =A0 struct per_cpu_pageset *pcp; > + > + =A0 =A0 =A0 if (likely(zalloc_cpumask_var(&cpus, GFP_ATOMIC))) { __GFP_NOWARN > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 for_each_online_cpu(cpu) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for_each_populated_zone(zon= e) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pcp =3D per= _cpu_ptr(zone->pageset, cpu); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (pcp->pc= p.count) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 cpumask_set_cpu(cpu, cpus); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 on_each_cpu_mask(cpus, drain_local_pages, N= ULL, 1); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 free_cpumask_var(cpus); > + =A0 =A0 =A0 } else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 on_each_cpu(drain_local_pages, NULL, 1); > =A0} > > =A0#ifdef CONFIG_HIBERNATION Acked-by: Pekka Enberg -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org