From 0cf4344f557935ccddfbf38bdc92c7981ebaa8f8 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Mon, 28 Nov 2005 13:44:03 -0800 Subject: [PATCH] --- yaml --- r: 14725 b: refs/heads/master c: 3148890bfa4f36c9949871264e06ef4d449eeff9 h: refs/heads/master i: 14723: 5df6e0434a0bade81d33d8f4fc78c0f6104eeb41 v: v3 --- [refs] | 2 +- trunk/mm/page_alloc.c | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index d7479a74b9cf..a93d5f70afe8 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: aa877b3dc9f2a1fdffac4ea36bee97c21db11a69 +refs/heads/master: 3148890bfa4f36c9949871264e06ef4d449eeff9 diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index 1731236dec35..b257720edfc8 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -773,9 +773,12 @@ buffered_rmqueue(struct zone *zone, int order, gfp_t gfp_flags) } #define ALLOC_NO_WATERMARKS 0x01 /* don't check watermarks at all */ -#define ALLOC_HARDER 0x02 /* try to alloc harder */ -#define ALLOC_HIGH 0x04 /* __GFP_HIGH set */ -#define ALLOC_CPUSET 0x08 /* check for correct cpuset */ +#define ALLOC_WMARK_MIN 0x02 /* use pages_min watermark */ +#define ALLOC_WMARK_LOW 0x04 /* use pages_low watermark */ +#define ALLOC_WMARK_HIGH 0x08 /* use pages_high watermark */ +#define ALLOC_HARDER 0x10 /* try to alloc harder */ +#define ALLOC_HIGH 0x20 /* __GFP_HIGH set */ +#define ALLOC_CPUSET 0x40 /* check for correct cpuset */ /* * Return 1 if free pages are above 'mark'. This takes into account the order @@ -830,7 +833,14 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, continue; if (!(alloc_flags & ALLOC_NO_WATERMARKS)) { - if (!zone_watermark_ok(*z, order, (*z)->pages_low, + unsigned long mark; + if (alloc_flags & ALLOC_WMARK_MIN) + mark = (*z)->pages_min; + else if (alloc_flags & ALLOC_WMARK_LOW) + mark = (*z)->pages_low; + else + mark = (*z)->pages_high; + if (!zone_watermark_ok(*z, order, mark, classzone_idx, alloc_flags)) continue; } @@ -871,7 +881,7 @@ __alloc_pages(gfp_t gfp_mask, unsigned int order, } page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, - zonelist, ALLOC_CPUSET); + zonelist, ALLOC_WMARK_LOW|ALLOC_CPUSET); if (page) goto got_pg; @@ -888,7 +898,7 @@ __alloc_pages(gfp_t gfp_mask, unsigned int order, * cannot run direct reclaim, or if the caller has realtime scheduling * policy. */ - alloc_flags = 0; + alloc_flags = ALLOC_WMARK_MIN; if ((unlikely(rt_task(p)) && !in_interrupt()) || !wait) alloc_flags |= ALLOC_HARDER; if (gfp_mask & __GFP_HIGH) @@ -959,7 +969,7 @@ __alloc_pages(gfp_t gfp_mask, unsigned int order, * under heavy pressure. */ page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, order, - zonelist, ALLOC_CPUSET); + zonelist, ALLOC_WMARK_HIGH|ALLOC_CPUSET); if (page) goto got_pg;