aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@virtuozzo.com>2016-01-14 18:19:38 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-14 19:00:49 -0500
commit316bda0e6cc5f36f94b4af8bded16d642c90ad75 (patch)
treef463b204e4e7968b3dcf5ddda6e4730f85426a5d /mm/vmscan.c
parent244d63ee345bd9d45c87f665ef5e3f7bcd5db45b (diff)
vmscan: do not force-scan file lru if its absolute size is small
We assume there is enough inactive page cache if the size of inactive file lru is greater than the size of active file lru, in which case we force-scan file lru ignoring anonymous pages. While this logic works fine when there are plenty of page cache pages, it fails if the size of file lru is small (several MB): in this case (lru_size >> prio) will be 0 for normal scan priorities, as a result, if inactive file lru happens to be larger than active file lru, anonymous pages of a cgroup will never get evicted unless the system experiences severe memory pressure, even if there are gigabytes of unused anonymous memory there, which is unfair in respect to other cgroups, whose workloads might be page cache oriented. This patch attempts to fix this by elaborating the "enough inactive page cache" check: it makes it not only check that inactive lru size > active lru size, but also that we will scan something from the cgroup at the current scan priority. If these conditions do not hold, we proceed to SCAN_FRACT as usual. Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Mel Gorman <mgorman@techsingularity.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 35dd57e99282..1dab3a3ddcd3 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2043,10 +2043,16 @@ static void get_scan_count(struct lruvec *lruvec, int swappiness,
2043 } 2043 }
2044 2044
2045 /* 2045 /*
2046 * There is enough inactive page cache, do not reclaim 2046 * If there is enough inactive page cache, i.e. if the size of the
2047 * anything from the anonymous working set right now. 2047 * inactive list is greater than that of the active list *and* the
2048 * inactive list actually has some pages to scan on this priority, we
2049 * do not reclaim anything from the anonymous working set right now.
2050 * Without the second condition we could end up never scanning an
2051 * lruvec even if it has plenty of old anonymous pages unless the
2052 * system is under heavy pressure.
2048 */ 2053 */
2049 if (!inactive_file_is_low(lruvec)) { 2054 if (!inactive_file_is_low(lruvec) &&
2055 get_lru_size(lruvec, LRU_INACTIVE_FILE) >> sc->priority) {
2050 scan_balance = SCAN_FILE; 2056 scan_balance = SCAN_FILE;
2051 goto out; 2057 goto out;
2052 } 2058 }