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  linux-cve-announce  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:	Wed, 26 Aug 2015 15:53:18 +0100
From:	Mel Gorman <mgorman@...hsingularity.net>
To:	Vlastimil Babka <vbabka@...e.cz>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Johannes Weiner <hannes@...xchg.org>,
	Rik van Riel <riel@...hat.com>,
	David Rientjes <rientjes@...gle.com>,
	Joonsoo Kim <iamjoonsoo.kim@....com>,
	Michal Hocko <mhocko@...nel.org>,
	Linux-MM <linux-mm@...ck.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 12/12] mm, page_alloc: Only enforce watermarks for
 order-0 allocations

On Wed, Aug 26, 2015 at 03:42:23PM +0200, Vlastimil Babka wrote:
> >@@ -2309,22 +2311,30 @@ static bool __zone_watermark_ok(struct zone *z, unsigned int order,
> >  #ifdef CONFIG_CMA
> >  	/* If allocation can't use CMA areas don't use free CMA pages */
> >  	if (!(alloc_flags & ALLOC_CMA))
> >-		free_cma = zone_page_state(z, NR_FREE_CMA_PAGES);
> >+		free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES);
> >  #endif
> >
> >-	if (free_pages - free_cma <= min + z->lowmem_reserve[classzone_idx])
> >+	if (free_pages <= min + z->lowmem_reserve[classzone_idx])
> >  		return false;
> >-	for (o = 0; o < order; o++) {
> >-		/* At the next order, this order's pages become unavailable */
> >-		free_pages -= z->free_area[o].nr_free << o;
> >
> >-		/* Require fewer higher order pages to be free */
> >-		min >>= 1;
> >+	/* order-0 watermarks are ok */
> >+	if (!order)
> >+		return true;
> >+
> >+	/* Check at least one high-order page is free */
> >+	for (o = order; o < MAX_ORDER; o++) {
> >+		struct free_area *area = &z->free_area[o];
> >+		int mt;
> >+
> >+		if (atomic && area->nr_free)
> >+			return true;
> >
> >-		if (free_pages <= min)
> >-			return false;
> >+		for (mt = 0; mt < MIGRATE_PCPTYPES; mt++) {
> >+			if (!list_empty(&area->free_list[mt]))
> >+				return true;
> >+		}
> 
> I think we really need something like this here:
> 
> #ifdef CONFIG_CMA
> if (alloc_flags & ALLOC_CMA)) &&
> 	!list_empty(&area->free_list[MIGRATE_CMA])
> 		return true;
> #endif
> 
> This is not about CMA and high-order atomic allocations being used at the
> same time. This is about high-order MIGRATE_MOVABLE allocations (that set
> ALLOC_CMA) failing to use MIGRATE_CMA pageblocks, which they should be
> allowed to use. It's complementary to the existing free_pages adjustment
> above.
> 
> Maybe there's not many high-order MIGRATE_MOVABLE allocations today, but
> they might increase with the driver migration framework. So why set up us a
> bomb.
> 

Ok, that seems sensible. Will apply this hunk on top

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1a4169be1498..10f25bf18665 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2337,6 +2337,13 @@ static bool __zone_watermark_ok(struct zone *z, unsigned int order,
 			if (!list_empty(&area->free_list[mt]))
 				return true;
 		}
+
+#ifdef CONFIG_CMA
+		if ((alloc_flags & ALLOC_CMA) &&
+		    !list_empty(&area->free_list[MIGRATE_CMA])) {
+			return true;
+		}
+#endif
 	}
 	return false;
 }
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ