[Devel] [PATCH RHEL7 COMMIT] mm/memcg: add missing hunk uncharge_kmem

Konstantin Khorenko khorenko at virtuozzo.com
Fri Mar 31 08:13:16 PDT 2017


The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.9
------>
commit a2ce9328a85bc74f89d0da4ff644fa7affe009cf
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Fri Mar 31 19:13:16 2017 +0400

    mm/memcg: add missing hunk uncharge_kmem
    
    Commit 355ccab81bc9 (reapply of commit a60971691) missed hunk from
    memcg_uncharge_kmem(), lost during rebase.
    
    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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e028861..6163e55 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3066,12 +3066,16 @@ void memcg_charge_kmem_nofail(struct mem_cgroup *memcg, unsigned long nr_pages)
 void memcg_uncharge_kmem(struct mem_cgroup *memcg,
 				unsigned long nr_pages)
 {
+	u64 kmem;
+
+	kmem = page_counter_uncharge(&memcg->kmem, nr_pages);
+
 	page_counter_uncharge(&memcg->memory, nr_pages);
 	if (do_swap_account)
 		page_counter_uncharge(&memcg->memsw, nr_pages);
 
 	/* Not down to 0 */
-	if (page_counter_uncharge(&memcg->kmem, nr_pages))
+	if (kmem)
 		return;
 
 	/*


More information about the Devel mailing list