aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmzone.h
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2014-04-03 17:47:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-03 19:21:01 -0400
commita528910e12ec7ee203095eb1711468a66b9b60b0 (patch)
treec9ceed84994f015e991161c91b87d47d93cd6491 /include/linux/mmzone.h
parent91b0abe36a7b2b3b02d7500925a5f8455334f0e5 (diff)
mm: thrash detection-based file cache sizing
The VM maintains cached filesystem pages on two types of lists. One list holds the pages recently faulted into the cache, the other list holds pages that have been referenced repeatedly on that first list. The idea is to prefer reclaiming young pages over those that have shown to benefit from caching in the past. We call the recently usedbut ultimately was not significantly better than a FIFO policy and still thrashed cache based on eviction speed, rather than actual demand for cache. This patch solves one half of the problem by decoupling the ability to detect working set changes from the inactive list size. By maintaining a history of recently evicted file pages it can detect frequently used pages with an arbitrarily small inactive list size, and subsequently apply pressure on the active list based on actual demand for cache, not just overall eviction speed. Every zone maintains a counter that tracks inactive list aging speed. When a page is evicted, a snapshot of this counter is stored in the now-empty page cache radix tree slot. On refault, the minimum access distance of the page can be assessed, to evaluate whether the page should be part of the active list or not. This fixes the VM's blindness towards working set changes in excess of the inactive list. And it's the foundation to further improve the protection ability and reduce the minimum inactive list size of 50%. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Rik van Riel <riel@redhat.com> Reviewed-by: Minchan Kim <minchan@kernel.org> Reviewed-by: Bob Liu <bob.liu@oracle.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Dave Chinner <david@fromorbit.com> Cc: Greg Thelen <gthelen@google.com> Cc: Hugh Dickins <hughd@google.com> Cc: Jan Kara <jack@suse.cz> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Luigi Semenzato <semenzato@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Metin Doslu <metin@citusdata.com> Cc: Michel Lespinasse <walken@google.com> Cc: Ozgun Erdogan <ozgun@citusdata.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Roman Gushchin <klamm@yandex-team.ru> Cc: Ryan Mallon <rmallon@gmail.com> Cc: Tejun Heo <tj@kernel.org> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r--include/linux/mmzone.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9b61b9bf81ac..f25db1d74a21 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -142,6 +142,8 @@ enum zone_stat_item {
142 NUMA_LOCAL, /* allocation from local node */ 142 NUMA_LOCAL, /* allocation from local node */
143 NUMA_OTHER, /* allocation from other node */ 143 NUMA_OTHER, /* allocation from other node */
144#endif 144#endif
145 WORKINGSET_REFAULT,
146 WORKINGSET_ACTIVATE,
145 NR_ANON_TRANSPARENT_HUGEPAGES, 147 NR_ANON_TRANSPARENT_HUGEPAGES,
146 NR_FREE_CMA_PAGES, 148 NR_FREE_CMA_PAGES,
147 NR_VM_ZONE_STAT_ITEMS }; 149 NR_VM_ZONE_STAT_ITEMS };
@@ -392,6 +394,9 @@ struct zone {
392 spinlock_t lru_lock; 394 spinlock_t lru_lock;
393 struct lruvec lruvec; 395 struct lruvec lruvec;
394 396
397 /* Evictions & activations on the inactive file list */
398 atomic_long_t inactive_age;
399
395 unsigned long pages_scanned; /* since last reclaim */ 400 unsigned long pages_scanned; /* since last reclaim */
396 unsigned long flags; /* zone flags, see below */ 401 unsigned long flags; /* zone flags, see below */
397 402