From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754853Ab2BHJdT (ORCPT ); Wed, 8 Feb 2012 04:33:19 -0500 Received: from mail-ee0-f46.google.com ([74.125.83.46]:42684 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751429Ab2BHJdR convert rfc822-to-8bit (ORCPT ); Wed, 8 Feb 2012 04:33:17 -0500 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: linux-kernel@vger.kernel.org, "Gilad Ben-Yossef" Cc: "KOSAKI Motohiro" , "Chris Metcalf" , "Frederic Weisbecker" , "Russell King" , linux-mm@kvack.org, "Pekka Enberg" , "Matt Mackall" , "Sasha Levin" , "Rik van Riel" , "Andi Kleen" , "Andrew Morton" , "Alexander Viro" , linux-fsdevel@vger.kernel.org, "Avi Kivity" , "Milton Miller" Subject: Re: [PATCH v8 7/8] mm: only IPI CPUs to drain local pages if they exist References: <1328448800-15794-1-git-send-email-gilad@benyossef.com> <1328449722-15959-6-git-send-email-gilad@benyossef.com> Date: Wed, 08 Feb 2012 10:33:13 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT From: "Michal Nazarewicz" Message-ID: In-Reply-To: <1328449722-15959-6-git-send-email-gilad@benyossef.com> User-Agent: Opera Mail/11.61 (Linux) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 05 Feb 2012 14:48:41 +0100, Gilad Ben-Yossef wrote: > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index d2186ec..3ff5aff 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1161,11 +1161,46 @@ void drain_local_pages(void *arg) > } > /* > - * Spill all the per-cpu pages from all CPUs back into the buddy allocator > + * Spill all the per-cpu pages from all CPUs back into the buddy allocator. > + * > + * Note that this code is protected against sending an IPI to an offline > + * CPU but does not guarantee sending an IPI to newly hotplugged CPUs: > + * on_each_cpu_mask() blocks hotplug and won't talk to offlined CPUs but > + * nothing keeps CPUs from showing up after we populated the cpumask and > + * before the call to on_each_cpu_mask(). > */ > void drain_all_pages(void) > { > - on_each_cpu(drain_local_pages, NULL, 1); > + int cpu; > + struct per_cpu_pageset *pcp; > + struct zone *zone; > + > + /* Allocate in the BSS so we wont require allocation in > + * direct reclaim path for CONFIG_CPUMASK_OFFSTACK=y > + */ If you are going to send next iteration, this comment should have “/*” on its own line just like comment below. > + static cpumask_t cpus_with_pcps; > + > + /* > + * We don't care about racing with CPU hotplug event > + * as offline notification will cause the notified > + * cpu to drain that CPU pcps and on_each_cpu_mask > + * disables preemption as part of its processing > + */ > + for_each_online_cpu(cpu) { > + bool has_pcps = false; > + for_each_populated_zone(zone) { > + pcp = per_cpu_ptr(zone->pageset, cpu); > + if (pcp->pcp.count) { > + has_pcps = true; > + break; > + } > + } > + if (has_pcps) > + cpumask_set_cpu(cpu, &cpus_with_pcps); > + else > + cpumask_clear_cpu(cpu, &cpus_with_pcps); > + } > + on_each_cpu_mask(&cpus_with_pcps, drain_local_pages, NULL, 1); > } > #ifdef CONFIG_HIBERNATION -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michał “mina86” Nazarewicz (o o) ooo +------------------ooO--(_)--Ooo-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michal Nazarewicz" Subject: Re: [PATCH v8 7/8] mm: only IPI CPUs to drain local pages if they exist Date: Wed, 08 Feb 2012 10:33:13 +0100 Message-ID: References: <1328448800-15794-1-git-send-email-gilad@benyossef.com> <1328449722-15959-6-git-send-email-gilad@benyossef.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Cc: "KOSAKI Motohiro" , "Chris Metcalf" , "Frederic Weisbecker" , "Russell King" , linux-mm@kvack.org, "Pekka Enberg" , "Matt Mackall" , "Sasha Levin" , "Rik van Riel" , "Andi Kleen" , "Andrew Morton" , "Alexander Viro" , linux-fsdevel@vger.kernel.org, "Avi Kivity" , "Milton Miller" To: linux-kernel@vger.kernel.org, "Gilad Ben-Yossef" Return-path: In-Reply-To: <1328449722-15959-6-git-send-email-gilad@benyossef.com> Sender: owner-linux-mm@kvack.org List-Id: linux-fsdevel.vger.kernel.org On Sun, 05 Feb 2012 14:48:41 +0100, Gilad Ben-Yossef wrote: > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index d2186ec..3ff5aff 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1161,11 +1161,46 @@ void drain_local_pages(void *arg) > } > /* > - * Spill all the per-cpu pages from all CPUs back into the buddy allo= cator > + * Spill all the per-cpu pages from all CPUs back into the buddy allo= cator. > + * > + * Note that this code is protected against sending an IPI to an offl= ine > + * CPU but does not guarantee sending an IPI to newly hotplugged CPUs= : > + * on_each_cpu_mask() blocks hotplug and won't talk to offlined CPUs = but > + * nothing keeps CPUs from showing up after we populated the cpumask = and > + * before the call to on_each_cpu_mask(). > */ > void drain_all_pages(void) > { > - on_each_cpu(drain_local_pages, NULL, 1); > + int cpu; > + struct per_cpu_pageset *pcp; > + struct zone *zone; > + > + /* Allocate in the BSS so we wont require allocation in > + * direct reclaim path for CONFIG_CPUMASK_OFFSTACK=3Dy > + */ If you are going to send next iteration, this comment should have =E2=80=9C/*=E2=80=9D on its own line just like comment below. > + static cpumask_t cpus_with_pcps; > + > + /* > + * We don't care about racing with CPU hotplug event > + * as offline notification will cause the notified > + * cpu to drain that CPU pcps and on_each_cpu_mask > + * disables preemption as part of its processing > + */ > + for_each_online_cpu(cpu) { > + bool has_pcps =3D false; > + for_each_populated_zone(zone) { > + pcp =3D per_cpu_ptr(zone->pageset, cpu); > + if (pcp->pcp.count) { > + has_pcps =3D true; > + break; > + } > + } > + if (has_pcps) > + cpumask_set_cpu(cpu, &cpus_with_pcps); > + else > + cpumask_clear_cpu(cpu, &cpus_with_pcps); > + } > + on_each_cpu_mask(&cpus_with_pcps, drain_local_pages, NULL, 1); > } > #ifdef CONFIG_HIBERNATION -- = Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=3D./ `o ..o | Computer Science, Micha=C5=82 =E2=80=9Cmina86=E2=80=9D Nazarewicz= (o o) ooo +------------------ooO--(_)--Ooo-- -- 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