lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 01 Jan 2012 19:52:16 +0100
From:	"Michal Nazarewicz" <mina86@...a86.com>
To:	"Gilad Ben-Yossef" <gilad@...yossef.com>
Cc:	"Marek Szyprowski" <m.szyprowski@...sung.com>,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-media@...r.kernel.org, linux-mm@...ck.org,
	linaro-mm-sig@...ts.linaro.org,
	"Kyungmin Park" <kyungmin.park@...sung.com>,
	"Russell King" <linux@....linux.org.uk>,
	"Andrew Morton" <akpm@...ux-foundation.org>,
	"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@...fujitsu.com>,
	"Daniel Walker" <dwalker@...eaurora.org>,
	"Mel Gorman" <mel@....ul.ie>, "Arnd Bergmann" <arnd@...db.de>,
	"Jesse Barker" <jesse.barker@...aro.org>,
	"Jonathan Corbet" <corbet@....net>,
	"Shariq Hasnain" <shariq.hasnain@...aro.org>,
	"Chunsang Jeong" <chunsang.jeong@...aro.org>,
	"Dave Hansen" <dave@...ux.vnet.ibm.com>,
	"Benjamin Gaignard" <benjamin.gaignard@...aro.org>
Subject: Re: [PATCH 01/11] mm: page_alloc: set_migratetype_isolate: drain PCP
 prior to isolating

On Sun, 01 Jan 2012 17:06:53 +0100, Gilad Ben-Yossef <gilad@...yossef.com> wrote:

> 2012/1/1 Michal Nazarewicz <mina86@...a86.com>:
>> Looks interesting, I'm not entirely sure why it does not end up a race
>> condition, but in case of __zone_drain_all_pages() we already hold

> If a page is in the PCP list when we check, you'll send the IPI and all is well.
>
> If it isn't when we check and gets added later you could just the same have
> situation where we send the IPI, try to do try an empty PCP list and then
> the page gets added. So we are not adding a race condition that is not there
> already :-)

Right, makes sense.

>> zone->lock, so my fears are somehow gone..  I'll give it a try, and prepare
>> a patch for __zone_drain_all_pages().

> I plan to send V5 of the IPI noise patch after some testing. It has a new
> version of the drain_all_pages, with no allocation in the reclaim path
> and no locking. You might want to wait till that one is out to base on it.

This shouldn't be a problem for my case as set_migratetype_isolate() is hardly
ever called in reclaim path. :)

The change so far seems rather obvious:

  mm/page_alloc.c |   14 +++++++++++++-
  1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 424d36a..eaa686b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1181,7 +1181,19 @@ static void __zone_drain_local_pages(void *arg)
   */
  static void __zone_drain_all_pages(struct zone *zone)
  {
-	on_each_cpu(__zone_drain_local_pages, zone, 1);
+	struct per_cpu_pageset *pcp;
+	cpumask_var_t cpus;
+	int cpu;
+
+	if (likely(zalloc_cpumask_var(&cpus, GFP_ATOMIC | __GFP_NOWARN))) {
+		for_each_online_cpu(cpu)
+			if (per_cpu_ptr(zone->pageset, cpu)->pcp.count)
+				cpumask_set_cpu(cpu, cpus);
+		on_each_cpu_mask(cpus, __zone_drain_local_pages, zone, 1);
+		free_cpumask_var(cpus);
+	} else {
+		on_each_cpu(__zone_drain_local_pages, zone, 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