]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm,vmscan: only evict file pages when we have plenty
authorRik van Riel <riel@redhat.com>
Sat, 3 Nov 2012 00:42:20 +0000 (11:42 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 8 Nov 2012 04:08:35 +0000 (15:08 +1100)
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 <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>
mm/vmscan.c

index 10090c8efd7698a989013922a4c65b88e0d81548..5abb92e32afb576f690734f11afea9d833600120 100644 (file)
@@ -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;
                }
        }