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

Submitted by Andrey Ryabinin on March 31, 2017, 1:51 p.m.

Details

Message ID 20170331135111.16715-1-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin March 31, 2017, 1:51 p.m.
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@virtuozzo.com>
---
 mm/memcontrol.c | 3 ---
 1 file changed, 3 deletions(-)

Patch hide | download patch | download mbox

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)