diff options
author | Rik van Riel <riel@redhat.com> | 2012-12-11 19:01:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 20:22:23 -0500 |
commit | e9868505987a03a26a3979f27b82911ccc003752 (patch) | |
tree | 14fded742fef30039b3ec4bf2350f857434b59ab /mm | |
parent | e749eb95531ac8349df47f8d46ce2641dcb16589 (diff) |
mm,vmscan: only evict file pages when we have plenty
If we have more inactive file pages than active file pages, we skip
scanning the active file pages altogether, with the idea that we do not
want to evict the working set when there is plenty of streaming IO in the
cache.
However, the code forgot to also skip scanning anonymous pages in that
situation. That leads to the curious situation of keeping the active file
pages protected from being paged out when there are lots of inactive file
pages, while still scanning and evicting anonymous pages.
This patch fixes that situation, by only evicting file pages when we have
plenty of them and most are inactive.
[akpm@linux-foundation.org: adjust comment layout]
Signed-off-by: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/vmscan.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index a1ce17f44be0..53947311c777 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1679,13 +1679,24 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, | |||
1679 | 1679 | ||
1680 | if (global_reclaim(sc)) { | 1680 | if (global_reclaim(sc)) { |
1681 | free = zone_page_state(zone, NR_FREE_PAGES); | 1681 | free = zone_page_state(zone, NR_FREE_PAGES); |
1682 | /* If we have very few page cache pages, | ||
1683 | force-scan anon pages. */ | ||
1684 | if (unlikely(file + free <= high_wmark_pages(zone))) { | 1682 | if (unlikely(file + free <= high_wmark_pages(zone))) { |
1683 | /* | ||
1684 | * If we have very few page cache pages, force-scan | ||
1685 | * anon pages. | ||
1686 | */ | ||
1685 | fraction[0] = 1; | 1687 | fraction[0] = 1; |
1686 | fraction[1] = 0; | 1688 | fraction[1] = 0; |
1687 | denominator = 1; | 1689 | denominator = 1; |
1688 | goto out; | 1690 | goto out; |
1691 | } else if (!inactive_file_is_low_global(zone)) { | ||
1692 | /* | ||
1693 | * There is enough inactive page cache, do not | ||
1694 | * reclaim anything from the working set right now. | ||
1695 | */ | ||
1696 | fraction[0] = 0; | ||
1697 | fraction[1] = 1; | ||
1698 | denominator = 1; | ||
1699 | goto out; | ||
1689 | } | 1700 | } |
1690 | } | 1701 | } |
1691 | 1702 | ||