]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm, page_alloc: only enforce watermarks for order-0 allocations -fix
authorMel Gorman <mgorman@techsingularity.net>
Wed, 21 Oct 2015 22:03:09 +0000 (09:03 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Oct 2015 22:03:09 +0000 (09:03 +1100)
This patch is updating comments for clarity and converts a bool to an int.
 The code as-is is ok as the compiler is meant to cast it correctly but it
looks odd to people who know the value would be truncated and lost for
other types.

This is a fix to the mmotm patch
mm-page_alloc-only-enforce-watermarks-for-order-0-allocations.patch

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Vitaly Wool <vitalywool@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c

index e009933b85821c9c6bf0040229c47f1a81d8fa83..33e9a23be1e88facedf886dad06f9d4a74a3ca20 100644 (file)
@@ -2333,7 +2333,7 @@ static bool __zone_watermark_ok(struct zone *z, unsigned int order,
 {
        long min = mark;
        int o;
-       const bool alloc_harder = (alloc_flags & ALLOC_HARDER);
+       const int alloc_harder = (alloc_flags & ALLOC_HARDER);
 
        /* free_pages may go negative - that's OK */
        free_pages -= (1 << order) - 1;
@@ -2357,14 +2357,19 @@ static bool __zone_watermark_ok(struct zone *z, unsigned int order,
                free_pages -= zone_page_state(z, NR_FREE_CMA_PAGES);
 #endif
 
+       /*
+        * Check watermarks for an order-0 allocation request. If these
+        * are not met, then a high-order request also cannot go ahead
+        * even if a suitable page happened to be free.
+        */
        if (free_pages <= min + z->lowmem_reserve[classzone_idx])
                return false;
 
-       /* order-0 watermarks are ok */
+       /* If this is an order-0 request then the watermark is fine */
        if (!order)
                return true;
 
-       /* Check at least one high-order page is free */
+       /* For a high-order request, check at least one suitable page is free */
        for (o = order; o < MAX_ORDER; o++) {
                struct free_area *area = &z->free_area[o];
                int mt;