• Lee Schermerhorn's avatar
    I noticed that alloc_bootmem_huge_page() will only advance to the next · 015970e8
    Lee Schermerhorn authored
    node on failure to allocate a huge page.  I asked about this on linux-mm
    and linux-numa, cc'ing the usual huge page suspects.  Mel Gorman
    responded:
    
    	I strongly suspect that the same node being used until allocation
    	failure instead of round-robin is an oversight and not deliberate
    	at all. It appears to be a side-effect of a fix made way back in
    	commit 63b4613c ["hugetlb: fix
    	hugepage allocation with memoryless nodes"]. Prior to that patch
    	it looked like allocations would always round-robin even when
    	allocation was successful.
    
    Andy Whitcroft countered that the existing behavior looked like Andi
    Kleen's original implementation and suggested that we ask him.  We did and
    Andy replied that his intention was to interleave the allocations.  So,
    ...
    
    This patch moves the advance of the hstate next node from which to
    allocate up before the test for success of the attempted allocation.  This
    will unconditionally advance the next node from which to alloc,
    interleaving successful allocations over the nodes with sufficient
    contiguous memory, and skipping over nodes that fail the huge page
    allocation attempt.
    
    Note that alloc_bootmem_huge_page() will only be called for huge pages of
    order > MAX_ORDER.
    Signed-off-by: default avatarLee Schermerhorn <lee.schermerhorn@hp.com>
    Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
    Cc: Mel Gorman <mel@csn.ul.ie>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Adam Litke <agl@us.ibm.com>
    Cc: Andy Whitcroft <apw@canonical.com>
    Cc: Eric Whitney <eric.whitney@hp.com>
    Cc: <stable@kernel.org>		[2.6.27.x, 2.6.28.x, 2.6.29.x, 2.6.30.x]
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    015970e8
hugetlb.c 61.7 KB