[Devel] [PATCH rh7] mm/memcg: don't overcharge ->memory counter when ->kmem limit reached.

Andrey Ryabinin aryabinin at virtuozzo.com
Mon Mar 5 12:48:40 MSK 2018


If charging the ->kmem counter was unsuccessful we don't call refill_stock()
to return charges consumed in consume_stock() and go to slowpath which
charges ->memory, ->memsw counters again. Hence we overcharge these counters
which leads to lockups during cgroup destruction.

https://jira.sw.ru/browse/PSBM-82021
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---

 Patch is only for kernels that don't have memory.cache.limit_in_bytes,
 e.g. 3.10.0-693.11.6.vz7.40.4
 Basically, this patch is for RK only.

 mm/memcontrol.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a165a221e87b..49509530c2c0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2790,6 +2790,7 @@ retry:
 			goto done;
 		if (!page_counter_try_charge(&memcg->kmem, nr_pages, &counter))
 			goto done;
+		refill_stock(memcg, nr_pages);
 	}
 
 	mem_over_limit = NULL;
-- 
2.16.1



More information about the Devel mailing list