[Devel] [PATCH rh7] memcg: do not call high reclaim if !__GFP_WAIT

Vladimir Davydov vdavydov at parallels.com
Thu May 28 09:54:29 PDT 2015


try_to_free_pages may sleep.

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 mm/memcontrol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6409fb28f00b..92928937f900 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2800,6 +2800,8 @@ static int mem_cgroup_do_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	return CHARGE_RETRY;
 
 done:
+	if (!(gfp_mask & __GFP_WAIT))
+		goto out;
 	/*
 	 * If the hierarchy is above the normal consumption range,
 	 * make the charging task trim their excess contribution.
@@ -2809,6 +2811,7 @@ done:
 			continue;
 		try_to_free_mem_cgroup_pages(memcg, nr_pages, gfp_mask, false);
 	} while ((memcg = parent_mem_cgroup(memcg)));
+out:
 	return CHARGE_OK;
 }
 
-- 
2.1.4




More information about the Devel mailing list