mm: kswapd: treat zone->all_unreclaimable in sleeping_prematurely similar to balance_...
authorMel Gorman <[email protected]>
Thu, 13 Jan 2011 23:46:24 +0000 (15:46 -0800)
committerLinus Torvalds <[email protected]>
Fri, 14 Jan 2011 01:32:37 +0000 (17:32 -0800)
After DEF_PRIORITY, balance_pgdat() considers all_unreclaimable zones to
be balanced but sleeping_prematurely does not.  This can force kswapd to
stay awake longer than it should.  This patch fixes it.

Signed-off-by: Mel Gorman <[email protected]>
Reviewed-by: Eric B Munson <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: KAMEZAWA Hiroyuki <[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 dafb9d91b60487b57ac0c89ce6a7ca7de2202b3a..388a0447b8e867ac84ad033de18a6535daf445b7 100644 (file)
@@ -2244,8 +2244,16 @@ static bool sleeping_prematurely(pg_data_t *pgdat, int order, long remaining)
                if (!populated_zone(zone))
                        continue;
 
-               if (zone->all_unreclaimable)
+               /*
+                * balance_pgdat() skips over all_unreclaimable after
+                * DEF_PRIORITY. Effectively, it considers them balanced so
+                * they must be considered balanced here as well if kswapd
+                * is to sleep
+                */
+               if (zone->all_unreclaimable) {
+                       balanced += zone->present_pages;
                        continue;
+               }
 
                if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone),
                                                                0, 0))