[Devel] [PATCH RHEL7 COMMIT] mm/memcg: fix margin computation for kmem limit.

Konstantin Khorenko khorenko at virtuozzo.com
Thu Mar 1 11:25:02 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.17.1.vz7.45.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.17.1.vz7.45.6
------>
commit 057df72c6cf1550ba1fbd50f05c3d64577b2b0f2
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Thu Mar 1 11:25:02 2018 +0300

    mm/memcg: fix margin computation for kmem limit.
    
    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;


More information about the Devel mailing list