Skip to content

Commit

Permalink
mm: vmscan: do not continue scanning if reclaim was aborted for compa…
Browse files Browse the repository at this point in the history
…ction

Direct reclaim is not aborting to allow compaction to go ahead properly.
do_try_to_free_pages is told to abort reclaim which is happily ignores
and instead increases priority instead until it reaches 0 and starts
shrinking file/anon equally.  This patch corrects the situation by
aborting reclaim when requested instead of raising priority.

Signed-off-by: Mel Gorman <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Kamezawa Hiroyuki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Mel Gorman authored and torvalds committed Jul 9, 2013
1 parent 7e9f5eb commit 5a1c9cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2361,8 +2361,10 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
aborted_reclaim = shrink_zones(zonelist, sc);

/*
* Don't shrink slabs when reclaiming memory from
* over limit cgroups
* Don't shrink slabs when reclaiming memory from over limit
* cgroups but do shrink slab at least once when aborting
* reclaim for compaction to avoid unevenly scanning file/anon
* LRU pages over slab pages.
*/
if (global_reclaim(sc)) {
unsigned long lru_pages = 0;
Expand Down Expand Up @@ -2404,7 +2406,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
WB_REASON_TRY_TO_FREE_PAGES);
sc->may_writepage = 1;
}
} while (--sc->priority >= 0);
} while (--sc->priority >= 0 && !aborted_reclaim);

out:
delayacct_freepages_end();
Expand Down

0 comments on commit 5a1c9cb

Please sign in to comment.