• Mel Gorman's avatar
    mm: kswapd: use the classzone idx that kswapd was using for sleeping_prematurely() · dc83edd9
    Mel Gorman authored
    When kswapd is woken up for a high-order allocation, it takes account of
    the highest usable zone by the caller (the classzone idx).  During
    allocation, this index is used to select the lowmem_reserve[] that should
    be applied to the watermark calculation in zone_watermark_ok().
    
    When balancing a node, kswapd considers the highest unbalanced zone to be
    the classzone index.  This will always be at least be the callers
    classzone_idx and can be higher.  However, sleeping_prematurely() always
    considers the lowest zone (e.g.  ZONE_DMA) to be the classzone index.
    This means that sleeping_prematurely() can consider a zone to be balanced
    that is unusable by the allocation request that originally woke kswapd.
    This patch changes sleeping_prematurely() to use a classzone_idx matching
    the value it used in balance_pgdat().
    Signed-off-by: default avatarMel Gorman <mel@csn.ul.ie>
    Reviewed-by: default avatarMinchan Kim <minchan.kim@gmail.com>
    Reviewed-by: default avatarEric B Munson <emunson@mgebm.net>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Simon Kirby <sim@hostway.ca>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Shaohua Li <shaohua.li@intel.com>
    Cc: Dave Hansen <dave@linux.vnet.ibm.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Rik van Riel <riel@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    dc83edd9
vmscan.c 91.8 KB