[Devel] [PATCH RHEL7 COMMIT] mm: Port diff-mm-vmscan-disable-fs-related-activity-for-direct-direct-reclaim

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 5 02:21:10 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.9
------>
commit 933717330ea5b65e67483bb6bc26f94ed6eb650e
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Fri Jun 5 13:21:10 2015 +0400

    mm: Port diff-mm-vmscan-disable-fs-related-activity-for-direct-direct-reclaim
    
    Author: Dmitry Monakhov
    Email: dmonakhov at openvz.org
    Subject: mm: disable fs-related activity for direct direct reclaim
    Date: Thu, 30 May 2013 18:57:41 +0400
    
    Suggested by alexey at . Avoid various interaction with fs on direct reclaim
    in order to avoid possible deadlocks. Let this works for kswapd.
    
    https://jira.sw.ru/browse/PSBM-20210
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
    
    =============================================================================
    
    Related to https://jira.sw.ru/browse/PSBM-33640
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 mm/vmscan.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index ed0aade..836bdb3 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2232,6 +2232,12 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc,
 {
 	struct reclaim_state *reclaim_state = current->reclaim_state;
 	unsigned long nr_reclaimed, nr_scanned;
+	gfp_t slab_gfp = sc->gfp_mask;
+
+	/* Disable fs-related IO for direct reclaim */
+	if (!sc->target_mem_cgroup &&
+	    (current->flags & (PF_MEMALLOC|PF_KSWAPD)) == PF_MEMALLOC)
+		slab_gfp &= ~__GFP_FS;
 
 	do {
 		struct mem_cgroup *root = sc->target_mem_cgroup;
@@ -2260,7 +2266,7 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc,
 			zone_lru_pages += lru_pages;
 
 			if (memcg && is_classzone)
-				shrink_slab(sc->gfp_mask, zone_to_nid(zone),
+				shrink_slab(slab_gfp, zone_to_nid(zone),
 					    memcg, sc->nr_scanned - scanned,
 					    lru_pages);
 
@@ -2286,7 +2292,7 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc,
 		 * the eligible LRU pages were scanned.
 		 */
 		if (global_reclaim(sc) && is_classzone)
-			shrink_slab(sc->gfp_mask, zone_to_nid(zone), NULL,
+			shrink_slab(slab_gfp, zone_to_nid(zone), NULL,
 				    sc->nr_scanned - nr_scanned,
 				    zone_lru_pages);
 



More information about the Devel mailing list