[Devel] [PATCH RHEL7 COMMIT] ms/mm/vmscan: never isolate more pages than necessary

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 28 07:50:33 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.6.3
------>
commit 703ed09d7ee4d9af6cec3c4970842f282176f5e0
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Fri Aug 28 18:50:33 2015 +0400

    ms/mm/vmscan: never isolate more pages than necessary
    
    ====
    Along with "[PATCH rh7] mm: vmscan: use proportional scanning during
    direct reclaim and full scan at DEF_PRIORITY" this should fix
    
    https://jira.sw.ru/browse/PSBM-35275
    
    I submitted this patch upstream (https://lkml.org/lkml/2015/8/3/404) and
    it was merged into the mmotm tree. Hopefully, it will get merged into
    Linus's tree soon.
    ====
    
    If transparent huge pages are enabled, we can isolate many more pages
    than we actually need to scan, because we count both single and huge
    pages equally in isolate_lru_pages().
    
    Since commit 5bc7b8aca942d ("mm: thp: add split tail pages to shrink
    page list in page reclaim"), we scan all the tail pages immediately
    after a huge page split (see shrink_page_list()). As a result, we can
    reclaim up to SWAP_CLUSTER_MAX * HPAGE_PMD_NR (512 MB) in one run!
    
    This is easy to catch on memcg reclaim with zswap enabled. The latter
    makes swapout instant so that if we happen to scan an unreferenced huge
    page we will evict both its head and tail pages immediately, which is
    likely to result in excessive reclaim.
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 mm/vmscan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2bb62ce..7beadf5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1297,7 +1297,8 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
 	unsigned long nr_taken = 0;
 	unsigned long scan;
 
-	for (scan = 0; scan < nr_to_scan && !list_empty(src); scan++) {
+	for (scan = 0; scan < nr_to_scan && nr_taken < nr_to_scan &&
+					!list_empty(src); scan++) {
 		struct page *page;
 		int nr_pages;
 



More information about the Devel mailing list