[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <op.v9cstne43l0zgt@mpn-glaptop>
Date: Wed, 08 Feb 2012 10:33:13 +0100
From: "Michal Nazarewicz" <mina86@...a86.com>
To: linux-kernel@...r.kernel.org,
"Gilad Ben-Yossef" <gilad@...yossef.com>
Cc: "KOSAKI Motohiro" <kosaki.motohiro@...fujitsu.com>,
"Chris Metcalf" <cmetcalf@...era.com>,
"Frederic Weisbecker" <fweisbec@...il.com>,
"Russell King" <linux@....linux.org.uk>, linux-mm@...ck.org,
"Pekka Enberg" <penberg@...nel.org>,
"Matt Mackall" <mpm@...enic.com>,
"Sasha Levin" <levinsasha928@...il.com>,
"Rik van Riel" <riel@...hat.com>,
"Andi Kleen" <andi@...stfloor.org>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Alexander Viro" <viro@...iv.linux.org.uk>,
linux-fsdevel@...r.kernel.org, "Avi Kivity" <avi@...hat.com>,
"Milton Miller" <miltonm@....com>
Subject: Re: [PATCH v8 7/8] mm: only IPI CPUs to drain local pages if they
exist
On Sun, 05 Feb 2012 14:48:41 +0100, Gilad Ben-Yossef <gilad@...yossef.com> 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 +----<email/xmpp: mpn@...gle.com>--------------ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists