From: Rik van Riel Date: Fri, 9 Nov 2012 03:04:05 +0000 (+1100) Subject: mm,vmscan: only evict file pages when we have plenty X-Git-Tag: next-20121112~5^2~235 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1e4e249e3a9d2b4cb5e5843e9c9a90f6a20c0cfc;p=karo-tx-linux.git 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. Signed-off-by: Rik van Riel Cc: Mel Gorman Cc: Johannes Weiner Signed-off-by: Andrew Morton --- diff --git a/mm/vmscan.c b/mm/vmscan.c index bc2af7fff2b9..d6dd126085f8 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1686,6 +1686,15 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc, fraction[1] = 0; denominator = 1; goto out; + } else if (!inactive_file_is_low_global(zone)) { + /* + * There is enough inactive page cache, do not + * reclaim anything from the working set right now. + */ + fraction[0] = 0; + fraction[1] = 1; + denominator = 1; + goto out; } }