Skip to content

Commit

Permalink
mm: kswapd: reset kswapd_max_order and classzone_idx after reading
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
gormanm authored and torvalds committed Jan 14, 2011
1 parent 0abdee2 commit 4d40502
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4d40502

Please sign in to comment.