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

Submitted by Konstantin Khorenko on Aug. 5, 2019, 3 p.m.

Details

Message ID 201908051500.x75F0V3T003278@finist-ce7.sw.ru
State New
Series "mm/memcg: use timeout instead of iteration count to determine leak."
Headers show

Commit Message

Konstantin Khorenko Aug. 5, 2019, 3 p.m.
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@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@virtuozzo.com>
---
 mm/memcontrol.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

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));
 }