[Devel] [PATCH rh7 2/2] mm/memcg: bypass kmem limits

Andrey Ryabinin aryabinin at virtuozzo.com
Wed Feb 28 13:36:27 MSK 2018


Relax kmem limit and bypass allocation anyway even if reclaim failed.

https://jira.sw.ru/browse/PSBM-81818
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memcontrol.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d68650ad7a53..32c6b254ce7d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2863,6 +2863,13 @@ charge:
 
 	if (gfp_mask & __GFP_NORETRY)
 		goto nomem;
+
+	if ((flags & MEM_CGROUP_RECLAIM_KMEM) && nr_retries--)
+		goto retry;
+
+	if (flags & MEM_CGROUP_RECLAIM_KMEM)
+		goto bypass;
+
 	/*
 	 * Even though the limit is exceeded at this point, reclaim
 	 * may have been able to free some pages.  Retry the charge
@@ -2895,7 +2902,7 @@ charge:
 nomem:
 	mem_cgroup_inc_failcnt(mem_over_limit, gfp_mask, nr_pages);
 
-	if (!(gfp_mask & __GFP_NOFAIL))
+	if (!(gfp_mask & __GFP_NOFAIL) && !(flags & MEM_CGROUP_RECLAIM_KMEM))
 		return -ENOMEM;
 bypass:
 	return -EINTR;
-- 
2.16.1



More information about the Devel mailing list