[Devel] [PATCH RHEL7 COMMIT] mm/memcg: Fix reparent warning again.

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jul 18 15:47:32 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.21.3.vz7.106.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.21.3.vz7.106.6
------>
commit 900534e557167be14ab5daf9022a591d9f5ea7a1
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Thu Jul 18 15:47:31 2019 +0300

    mm/memcg: Fix reparent warning again.
    
    In case of unsuccessful reparenting reparent_attempts counter
    will be -1, so intended warning will not trigger. Check diff
    of ->memory - ->kmem counters instead. It's correct and easier
    to read.
    
    Fixes: e548e343c40b ("mm/memcontrol: don't reparent forever if counter
    leaked.")
    Fixes: 73bad91e8fc2 ("mm/memcontrol: warn about leaking memory on reparenting
    after 100 attempts")
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memcontrol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3fabad9d409c..acbe83875cdc 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4379,7 +4379,8 @@ static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 	} while ((page_counter_read(&memcg->memory) -
 		 page_counter_read(&memcg->kmem) > 0) && reparent_attempts--);
 
-	WARN_ONCE(!reparent_attempts,
+	WARN_ONCE((page_counter_read(&memcg->memory) -
+			page_counter_read(&memcg->kmem) > 0),
 		  "memcg 0x%p leak suspected, performed %d iterations: "
 		  "memory=%lu, kmem=%lu",
 		  memcg,



More information about the Devel mailing list