[Devel] [PATCH rh7 1/2] mm/memcg: fix margin computation for kmem limit.

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


if kmem usage is above kmem.limit mem_cgroup_margin() we return
non-zero margin possibly leading to endless loop in try_charge().

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

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b4d61d72ccbf..d68650ad7a53 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1829,6 +1829,8 @@ static unsigned long mem_cgroup_margin(struct mem_cgroup *memcg, bool kmem)
 		limit = READ_ONCE(memcg->kmem.limit);
 		if (count <= limit)
 			margin = min(margin, limit - count);
+		else
+			margin = 0;
 	}
 
 	return margin;
-- 
2.16.1



More information about the Devel mailing list