page allocator: check only once if the zonelist is suitable for the allocation
authorMel Gorman <[email protected]>
Tue, 16 Jun 2009 22:31:56 +0000 (15:31 -0700)
committerLinus Torvalds <[email protected]>
Wed, 17 Jun 2009 02:47:32 +0000 (19:47 -0700)
It is possible with __GFP_THISNODE that no zones are suitable.  This patch
makes sure the check is only made once.

Signed-off-by: Mel Gorman <[email protected]>
Reviewed-by: Christoph Lameter <[email protected]>
Reviewed-by: KOSAKI Motohiro <[email protected]>
Reviewed-by: Pekka Enberg <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Lee Schermerhorn <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c

index bfbd95c0610fb8e6bad08ebada8c5966155efb61..6be8fcb6f74f8cfbed43e825fa4d9e006a4837d1 100644 (file)
@@ -1483,9 +1483,8 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
        if (should_fail_alloc_page(gfp_mask, order))
                return NULL;
 
-restart:
-       z = zonelist->_zonerefs;  /* the list of zones suitable for gfp_mask */
-
+       /* the list of zones suitable for gfp_mask */
+       z = zonelist->_zonerefs;
        if (unlikely(!z->zone)) {
                /*
                 * Happens if we have an empty zonelist as a result of
@@ -1494,6 +1493,7 @@ restart:
                return NULL;
        }
 
+restart:
        page = get_page_from_freelist(gfp_mask|__GFP_HARDWALL, nodemask, order,
                        zonelist, high_zoneidx, ALLOC_WMARK_LOW|ALLOC_CPUSET);
        if (page)