mm: kswapd: reset kswapd_max_order and classzone_idx after reading
authorMel Gorman <[email protected]>
Thu, 13 Jan 2011 23:46:23 +0000 (15:46 -0800)
committerLinus Torvalds <[email protected]>
Fri, 14 Jan 2011 01:32:37 +0000 (17:32 -0800)
When kswapd wakes up, it reads its order and classzone from pgdat and
calls balance_pgdat.  While its awake, it potentially reclaimes at a high
order and a low classzone index.  This might have been a once-off that was
not required by subsequent callers.  However, because the pgdat values
were not reset, they remain artifically high while balance_pgdat() is
running and potentially kswapd enters a second unnecessary reclaim cycle.
Reset the pgdat order and classzone index after reading.

Signed-off-by: Mel Gorman <[email protected]>
Reviewed-by: Minchan Kim <[email protected]>
Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
Reviewed-by: Eric B Munson <[email protected]>
Cc: Simon Kirby <[email protected]>
Cc: KOSAKI Motohiro <[email protected]>
Cc: Shaohua Li <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Rik van Riel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/vmscan.c

index 46711f080f3830fa0bb5a53bb33884f47066aa28..dafb9d91b60487b57ac0c89ce6a7ca7de2202b3a 100644 (file)
@@ -2653,6 +2653,8 @@ static int kswapd(void *p)
                        kswapd_try_to_sleep(pgdat, order);
                        order = pgdat->kswapd_max_order;
                        classzone_idx = pgdat->classzone_idx;
+                       pgdat->kswapd_max_order = 0;
+                       pgdat->classzone_idx = MAX_NR_ZONES - 1;
                }
 
                ret = try_to_freeze();