[Devel] [PATCH RHEL7 COMMIT] mm/memcg: use timeout instead of iteration count to determine leak.

Konstantin Khorenko khorenko at virtuozzo.com
Mon Aug 5 18:00:33 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.7
------>
commit 6c56498a819e466bd11b6c91eb4d65fda77b8dd1
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Mon Aug 5 18:00:31 2019 +0300

    mm/memcg: use timeout instead of iteration count to determine leak.
    
    100 reparent attempts seems too low, and hits too often.
    Try to use 2min timeout instead.
    
    https://jira.sw.ru/browse/PSBM-96533
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memcontrol.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index acbe83875cdc..884f1596bb24 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4344,7 +4344,7 @@ static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 {
 	int node, zid;
 	/* Protection from leaked memcg->memory counter. */
-	int reparent_attempts = 99;
+	unsigned long timeout = jiffies + HZ*120;
 
 	do {
 		/* This is for making all *used* pages to be on LRU. */
@@ -4377,14 +4377,13 @@ static void mem_cgroup_reparent_charges(struct mem_cgroup *memcg)
 		 * charge before adding to the LRU.
 		 */
 	} while ((page_counter_read(&memcg->memory) -
-		 page_counter_read(&memcg->kmem) > 0) && reparent_attempts--);
+		 page_counter_read(&memcg->kmem) > 0) && time_after(jiffies, timeout));
 
 	WARN_ONCE((page_counter_read(&memcg->memory) -
 			page_counter_read(&memcg->kmem) > 0),
-		  "memcg 0x%p leak suspected, performed %d iterations: "
+		  "memcg 0x%p leak suspected: "
 		  "memory=%lu, kmem=%lu",
 		  memcg,
-		  100,
 		  page_counter_read(&memcg->memory),
 		  page_counter_read(&memcg->kmem));
 }



More information about the Devel mailing list