Skip to content

Commit

Permalink
mm: vmscan: correct use of pgdat_balanced in sleeping_prematurely
Browse files Browse the repository at this point in the history
There are a few reports of people experiencing hangs when copying large
amounts of data with kswapd using a large amount of CPU which appear to be
due to recent reclaim changes.  SLUB using high orders is the trigger but
not the root cause as SLUB has been using high orders for a while.  The
root cause was bugs introduced into reclaim which are addressed by the
following two patches.

Patch 1 corrects logic introduced by commit 1741c87 ("mm: kswapd:
        keep kswapd awake for high-order allocations until a percentage of
        the node is balanced") to allow kswapd to go to sleep when
        balanced for high orders.

Patch 2 notes that it is possible for kswapd to miss every
        cond_resched() and updates shrink_slab() so it'll at least reach
        that scheduling point.

Chris Wood reports that these two patches in isolation are sufficient to
prevent the system hanging.  AFAIK, they should also resolve similar hangs
experienced by James Bottomley.

This patch:

Johannes Weiner poined out that the logic in commit 1741c87 ("mm: kswapd:
keep kswapd awake for high-order allocations until a percentage of the
node is balanced") is backwards.  Instead of allowing kswapd to go to
sleep when balancing for high order allocations, it keeps it kswapd
running uselessly.

Signed-off-by: Mel Gorman <[email protected]>
Reviewed-by: Rik van Riel <[email protected]>
Signed-off-by: Johannes Weiner <[email protected]>
Reviewed-by: Wu Fengguang <[email protected]>
Cc: James Bottomley <[email protected]>
Tested-by: Colin King <[email protected]>
Cc: Raghavendra D Prabhu <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Chris Mason <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Rik van Riel <[email protected]>
Reviewed-by: Minchan Kim <[email protected]>
Reviewed-by: Wu Fengguang <[email protected]>
Cc: <[email protected]>		[2.6.38+]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
hnaz authored and torvalds committed May 25, 2011
1 parent a71ae47 commit afc7e32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,7 @@ static bool sleeping_prematurely(pg_data_t *pgdat, int order, long remaining,
* must be balanced
*/
if (order)
return pgdat_balanced(pgdat, balanced, classzone_idx);
return !pgdat_balanced(pgdat, balanced, classzone_idx);
else
return !all_zones_ok;
}
Expand Down

0 comments on commit afc7e32

Please sign in to comment.