[Devel] [PATCH rh7 2/2] Revert "mm: vmscan: do not scan lruvec if it seems to be unreclaimable"

Vladimir Davydov vdavydov at virtuozzo.com
Fri Jan 22 03:47:21 PST 2016


This reverts commit 92dd01fd61017f4efc7819bc5f5711981dcd6a88.

The patch being reverted was introduced in order to fix PSBM-35155. At
that time I used memory.high to avoid kmem allocation failures - it was
set by vcmmd to be several percent less than memory.limit, so that there
should almost always be some gap between limit and usage for a container
to grow its memory before hitting OOM. In fact, this was kinda abusing
memory.high. The whole point of memory.high is avoiding OOM, so it
shouldn't be unexpected at all that OOM was delayed by orders of
magnitude if memory.high was set. So I introduced this heuristic to make
OOM happen earlier even if memory.high is set below memory.limit.

This workaround had a downside - it resulted in premature OOM, which
spuriously failed our tests. Nowadays, I don't use memory.high as a
protection against kmem allocation failures - I just never fail them.
So revert the workaround.

Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 include/linux/mmzone.h |  1 -
 mm/swap.c              |  1 -
 mm/vmscan.c            | 23 -----------------------
 3 files changed, 25 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index faf3c96abed2..abe7110d8fbe 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -211,7 +211,6 @@ struct zone_reclaim_stat {
 struct lruvec {
 	struct list_head lists[NR_LRU_LISTS];
 	struct zone_reclaim_stat reclaim_stat;
-	unsigned long pages_scanned;
 #ifdef CONFIG_MEMCG
 	struct zone *zone;
 #endif
diff --git a/mm/swap.c b/mm/swap.c
index 68dd2895c2f4..0a42ebf1b926 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -61,7 +61,6 @@ static void __page_cache_release(struct page *page)
 		VM_BUG_ON_PAGE(!PageLRU(page), page);
 		__ClearPageLRU(page);
 		del_page_from_lru_list(page, lruvec, page_off_lru(page));
-		lruvec->pages_scanned = 0;
 		spin_unlock_irqrestore(&zone->lru_lock, flags);
 	}
 }
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 3b96a02eaddd..0406c11287f5 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -178,20 +178,6 @@ static unsigned long get_lru_size(struct lruvec *lruvec, enum lru_list lru)
 	return zone_page_state(lruvec_zone(lruvec), NR_LRU_BASE + lru);
 }
 
-static bool lruvec_reclaimable(struct lruvec *lruvec, bool may_swap)
-{
-	unsigned long reclaimable;
-
-	reclaimable = get_lru_size(lruvec, LRU_ACTIVE_FILE) +
-		      get_lru_size(lruvec, LRU_INACTIVE_FILE);
-
-	if (may_swap && get_nr_swap_pages() > 0)
-		reclaimable += get_lru_size(lruvec, LRU_ACTIVE_ANON) +
-			       get_lru_size(lruvec, LRU_INACTIVE_ANON);
-
-	return lruvec->pages_scanned < reclaimable * 6;
-}
-
 /*
  * Add a shrinker callback to be called from the vm.
  */
@@ -1543,7 +1529,6 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
 	__mod_zone_page_state(zone, NR_LRU_BASE + lru, -nr_taken);
 	__mod_zone_page_state(zone, NR_ISOLATED_ANON + file, nr_taken);
 
-	lruvec->pages_scanned += nr_scanned;
 	if (global_reclaim(sc)) {
 		zone->pages_scanned += nr_scanned;
 		if (current_is_kswapd())
@@ -1563,9 +1548,6 @@ shrink_inactive_list(unsigned long nr_to_scan, struct lruvec *lruvec,
 
 	spin_lock_irq(&zone->lru_lock);
 
-	if (nr_reclaimed)
-		lruvec->pages_scanned = 0;
-
 	reclaim_stat->recent_scanned[file] += nr_taken;
 
 	if (global_reclaim(sc)) {
@@ -1739,7 +1721,6 @@ static void shrink_active_list(unsigned long nr_to_scan,
 
 	nr_taken = isolate_lru_pages(nr_to_scan, lruvec, &l_hold,
 				     &nr_scanned, sc, isolate_mode, lru);
-	lruvec->pages_scanned += nr_scanned;
 	if (global_reclaim(sc))
 		zone->pages_scanned += nr_scanned;
 
@@ -2376,10 +2357,6 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc,
 				continue;
 
 			lruvec = mem_cgroup_zone_lruvec(zone, memcg);
-			if (!global_reclaim(sc) &&
-			    !lruvec_reclaimable(lruvec, sc->may_swap))
-				continue;
-
 			scanned = sc->nr_scanned;
 
 			shrink_lruvec(lruvec, sc, &lru_pages);
-- 
2.1.4



More information about the Devel mailing list