[Devel] [PATCH rh7 1/7] mm/memcg: uncharge ->memory ->memsw if try charge of ->kmem fails

Andrey Ryabinin aryabinin at virtuozzo.com
Fri Mar 31 06:51:05 PDT 2017


if page_counter_try_charge(&memcg->kmem, nr_pages) fails we bail out
from memcg_charge_kmem() too early without uncharging back ->memory and ->memsw

https://jira.sw.ru/browse/PSBM-62827
Fixes: 355ccab81bc9 ("mm: memcontrol: fix race between kmem uncharge and charge reparenting")
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memcontrol.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 74faf07..e028861 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3043,9 +3043,6 @@ int memcg_charge_kmem(struct mem_cgroup *memcg, gfp_t gfp,
 	 * uncharged before res.
 	 */
 	ret = page_counter_try_charge(&memcg->kmem, nr_pages, &counter);
-	if (ret < 0)
-		return ret;
-
 	if (ret) {
 		page_counter_uncharge(&memcg->memory, nr_pages);
 		if (do_swap_account)
-- 
2.10.2



More information about the Devel mailing list