mm-thrash-detection-based-file-cache-sizing.patch removed from -mm tree
Subsystems (6)
[email protected]
maintainerSubject: [merged] mm-thrash-detection-based-file-cache-sizing.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Fri, 04 Apr 2014 12:31:29 -0700
The patch titled
Subject: mm: thrash detection-based file cache sizing
has been removed from the -mm tree. Its filename was
mm-thrash-detection-based-file-cache-sizing.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Johannes Weiner <[email protected]>
Subject: 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%.
---
include/linux/mmzone.h | 5 include/linux/swap.h | 5 mm/Makefile | 2 mm/filemap.c | 61 ++++++--- mm/swap.c | 2 mm/vmscan.c | 24 ++- mm/vmstat.c | 2 mm/workingset.c | 253 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 331 insertions(+), 23 deletions(-)
include/linux/mmzone.h renamed from include/linux/mmzone.h~mm-thrash-detection-based-file-cache-sizing +5 -0
@@ -142,6 +142,8 @@ enum zone_stat_item {NUMA_LOCAL ,/* allocation from local node */ NUMA_OTHER ,/* allocation from other node */ #endif +WORKINGSET_REFAULT , +WORKINGSET_ACTIVATE ,NR_ANON_TRANSPARENT_HUGEPAGES ,NR_FREE_CMA_PAGES , NR_VM_ZONE_STAT_ITEMS };
@@ -392,6 +394,9 @@ struct zone {spinlock_t lru_lock;struct lruvec lruvec; +/* Evictions & activations on the inactive file list */ +atomic_long_t inactive_age; +unsigned long pages_scanned;/* since last reclaim */ unsigned long flags;/* zone flags, see below */
include/linux/swap.h renamed from include/linux/swap.h~mm-thrash-detection-based-file-cache-sizing +5 -0
@@ -260,6 +260,11 @@ struct swap_list_t {int next;/* swapfile to be used next */ }; +/* linux/mm/workingset.c */ +void *workingset_eviction (struct address_space *mapping,struct page *page); +bool workingset_refault (void *shadow); +void workingset_activation (struct page *page); +/* linux/mm/page_alloc.c */ extern unsigned long totalram_pages;extern unsigned long totalreserve_pages;
mm/Makefile renamed from mm/Makefile~mm-thrash-detection-based-file-cache-sizing +1 -1
@@ -17,7 +17,7 @@ obj-y := filemap.o mempool.o oom_kill. util.o mmzone.o vmstat.o backing-dev.o \ mm_init.o mmu_context.o percpu.o slab_common.o \ compaction.o balloon_compaction.o \ - interval_tree.o list_lru.o $(mmu-y) + interval_tree.o list_lru.o workingset.o $(mmu-y) obj-y += init-mm.o
mm/filemap.c renamed from mm/filemap.c~mm-thrash-detection-based-file-cache-sizing +44 -17
98 lines not on this page · raw message
mm/swap.c renamed from mm/swap.c~mm-thrash-detection-based-file-cache-sizing +2 -0
@@ -574,6 +574,8 @@ void mark_page_accessed(struct page *pagelse __lru_cache_activate_page (page);ClearPageReferenced (page); +if (page_is_file_cache (page)) +workingset_activation (page); }else if (!PageReferenced (page)) {SetPageReferenced (page); }
mm/vmscan.c renamed from mm/vmscan.c~mm-thrash-detection-based-file-cache-sizing +19 -5
@@ -523,7 +523,8 @@ static pageout_t pageout(struct page *pa* Same as remove_mapping, but if the page is removed from the mapping, it * gets returned with a refcount of 0. */ -static int __remove_mapping (struct address_space *mapping,struct page *page) +static int __remove_mapping (struct address_space *mapping,struct page *page, +bool reclaimed) {BUG_ON (!PageLocked (page));BUG_ON (mapping !=page_mapping (page));
@@ -569,10 +570,23 @@ static int __remove_mapping(struct addreswapcache_free (swap, page); }else {void (*freepage)(struct page *); +void *shadow =NULL ; freepage = mapping->a_ops->freepage; - -__delete_from_page_cache (page,NULL ); +/* +* Remember a shadow entry for reclaimed file cache in +* order to detect refaults, thus thrashing, later on. +* +* But don't store shadows in an address space that is +* already exiting. This is not just an optizimation, +* inode reclaim needs to empty out the radix tree or +* the nodes are lost. Don't plant shadows behind its +* back. +*/ +if (reclaimed &&page_is_file_cache (page) && + !mapping_exiting (mapping)) + shadow =workingset_eviction (mapping, page); +__delete_from_page_cache (page, shadow);spin_unlock_irq (&mapping->tree_lock);mem_cgroup_uncharge_cache_page (page);
@@ -595,7 +609,7 @@ cannot_free:*/ int remove_mapping (struct address_space *mapping,struct page *page) { -if (__remove_mapping (mapping, page)) { +if (__remove_mapping (mapping, page, false)) {/* * Unfreezing the refcount with 1 rather than 2 effectively * drops the pagecache ref for us without requiring another
@@ -1065,7 +1079,7 @@ static unsigned long shrink_page_list(st } } -if (!mapping || !__remove_mapping (mapping, page)) +if (!mapping || !__remove_mapping (mapping, page, true)) goto keep_locked;/*
mm/vmstat.c renamed from mm/vmstat.c~mm-thrash-detection-based-file-cache-sizing +2 -0
@@ -770,6 +770,8 @@ const char * const vmstat_text[] = {"numa_local" ,"numa_other" , #endif +"workingset_refault" , +"workingset_activate" ,"nr_anon_transparent_hugepages" ,"nr_free_cma" , "nr_dirty_threshold",
mm/workingset.c new file +253 -0
253 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
origin.patch
pagewalk-update-page-table-walker-core.patch pagewalk-add-walk_page_vma.patch smaps-redefine-callback-functions-for-page-table-walker.patch clear_refs-redefine-callback-functions-for-page-table-walker.patch pagemap-redefine-callback-functions-for-page-table-walker.patch numa_maps-redefine-callback-functions-for-page-table-walker.patch memcg-redefine-callback-functions-for-page-table-walker.patch arch-powerpc-mm-subpage-protc-use-walk_page_vma-instead-of-walk_page_range.patch pagewalk-remove-argument-hmask-from-hugetlb_entry.patch mempolicy-apply-page-table-walker-on-queue_pages_range.patch mm-revert-thp-make-madv_hugepage-check-for-mm-def_flags.patch mm-thp-add-vm_init_def_mask-and-prctl_thp_disable.patch exec-kill-the-unnecessary-mm-def_flags-setting-in-load_elf_binary.patch fork-collapse-copy_flags-into-copy_process.patch mm-mempolicy-rename-slab_node-for-clarity.patch mm-mempolicy-remove-per-process-flag.patch res_counter-remove-interface-for-locked-charging-and-uncharging.patch mm-vmallocc-enhance-vm_map_ram-comment.patch mm-vmallocc-enhance-vm_map_ram-comment-fix.patch mm-memcg-remove-unnecessary-preemption-disabling.patch mm-memcg-remove-mem_cgroup_move_account_page_stat.patch mm-memcg-inline-mem_cgroup_charge_common.patch mm-memcg-push-mm-handling-out-to-page-cache-charge-function.patch memcg-remove-unnecessary-mm-check-from-try_get_mem_cgroup_from_mm.patch memcg-get_mem_cgroup_from_mm.patch memcg-get_mem_cgroup_from_mm-fix.patch memcg-do-not-replicate-get_mem_cgroup_from_mm-in-__mem_cgroup_try_charge.patch memcg-sanitize-__mem_cgroup_try_charge-call-protocol.patch memcg-sanitize-__mem_cgroup_try_charge-call-protocol-fix.patch memcg-rename-high-level-charging-functions.patch mm-page_alloc-spill-to-remote-nodes-before-waking-kswapd.patch linux-next.patch
memcg-slab-never-try-to-merge-memcg-caches.patch memcg-slab-cleanup-memcg-cache-creation.patch memcg-slab-separate-memcg-vs-root-cache-creation-paths.patch memcg-slab-unregister-cache-from-memcg-before-starting-to-destroy-it.patch memcg-slab-do-not-destroy-children-caches-if-parent-has-aliases.patch slub-adjust-memcg-caches-when-creating-cache-alias.patch slub-rework-sysfs-layout-for-memcg-caches.patch debugging-keep-track-of-page-owners.patch