mm, vmscan: have kswapd only scan based on the highest requested zone
authorMel Gorman <mgorman@techsingularity.net>
Thu, 28 Jul 2016 22:45:40 +0000 (15:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Jul 2016 23:07:41 +0000 (16:07 -0700)
kswapd checks all eligible zones to see if they need balancing even if
it was woken for a lower zone.  This made sense when we reclaimed on a
per-zone basis because we wanted to shrink zones fairly so avoid
age-inversion problems.  Ideally this is completely unnecessary when
reclaiming on a per-node basis.  In theory, there may still be anomalies
when all requests are for lower zones and very old pages are preserved
in higher zones but this should be the exceptional case.

Link: http://lkml.kernel.org/r/1467970510-21195-7-git-send-email-mgorman@techsingularity.net
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rik van Riel <riel@surriel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/vmscan.c

index 766b36bec829b85f105df9c54911c4864edee6be..c6e61dae382bd93de003b687e1b3725807144bc2 100644 (file)
@@ -3209,11 +3209,8 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx)
 
                sc.nr_reclaimed = 0;
 
-               /*
-                * Scan in the highmem->dma direction for the highest
-                * zone which needs scanning
-                */
-               for (i = pgdat->nr_zones - 1; i >= 0; i--) {
+               /* Scan from the highest requested zone to dma */
+               for (i = classzone_idx; i >= 0; i--) {
                        struct zone *zone = pgdat->node_zones + i;
 
                        if (!populated_zone(zone))