lkml.org 
[lkml]   [2014]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.13 002/149] mm: page_alloc: exempt GFP_THISNODE allocations from zone fairness
    Date
    3.13-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Johannes Weiner <hannes@cmpxchg.org>

    commit 27329369c9ecf37771b2a65202cbf5578cff3331 upstream.

    Jan Stancek reports manual page migration encountering allocation
    failures after some pages when there is still plenty of memory free, and
    bisected the problem down to commit 81c0a2bb515f ("mm: page_alloc: fair
    zone allocator policy").

    The problem is that GFP_THISNODE obeys the zone fairness allocation
    batches on one hand, but doesn't reset them and wake kswapd on the other
    hand. After a few of those allocations, the batches are exhausted and
    the allocations fail.

    Fixing this means either having GFP_THISNODE wake up kswapd, or
    GFP_THISNODE not participating in zone fairness at all. The latter
    seems safer as an acute bugfix, we can clean up later.

    Reported-by: Jan Stancek <jstancek@redhat.com>
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Rik van Riel <riel@redhat.com>
    Acked-by: Mel Gorman <mgorman@suse.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    mm/page_alloc.c | 26 ++++++++++++++++++++++----
    1 file changed, 22 insertions(+), 4 deletions(-)

    --- a/mm/page_alloc.c
    +++ b/mm/page_alloc.c
    @@ -1211,6 +1211,15 @@ void drain_zone_pages(struct zone *zone,
    }
    local_irq_restore(flags);
    }
    +static bool gfp_thisnode_allocation(gfp_t gfp_mask)
    +{
    + return (gfp_mask & GFP_THISNODE) == GFP_THISNODE;
    +}
    +#else
    +static bool gfp_thisnode_allocation(gfp_t gfp_mask)
    +{
    + return false;
    +}
    #endif

    /*
    @@ -1547,7 +1556,13 @@ again:
    get_pageblock_migratetype(page));
    }

    - __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order));
    + /*
    + * NOTE: GFP_THISNODE allocations do not partake in the kswapd
    + * aging protocol, so they can't be fair.
    + */
    + if (!gfp_thisnode_allocation(gfp_flags))
    + __mod_zone_page_state(zone, NR_ALLOC_BATCH, -(1 << order));
    +
    __count_zone_vm_events(PGALLOC, zone, 1 << order);
    zone_statistics(preferred_zone, zone, gfp_flags);
    local_irq_restore(flags);
    @@ -1919,8 +1934,12 @@ zonelist_scan:
    * ultimately fall back to remote zones that do not
    * partake in the fairness round-robin cycle of this
    * zonelist.
    + *
    + * NOTE: GFP_THISNODE allocations do not partake in
    + * the kswapd aging protocol, so they can't be fair.
    */
    - if (alloc_flags & ALLOC_WMARK_LOW) {
    + if ((alloc_flags & ALLOC_WMARK_LOW) &&
    + !gfp_thisnode_allocation(gfp_mask)) {
    if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0)
    continue;
    if (!zone_local(preferred_zone, zone))
    @@ -2486,8 +2505,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u
    * allowed per node queues are empty and that nodes are
    * over allocated.
    */
    - if (IS_ENABLED(CONFIG_NUMA) &&
    - (gfp_mask & GFP_THISNODE) == GFP_THISNODE)
    + if (gfp_thisnode_allocation(gfp_mask))
    goto nopage;

    restart:



    \
     
     \ /
      Last update: 2014-03-21 09:21    [W:4.038 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site