[RHEL7,COMMIT] mm/memcg: correct timeout check.

Submitted by Konstantin Khorenko on Aug. 8, 2019, 3:02 p.m.

Details

Message ID 201908081502.x78F2dRY018424@finist-ce7.sw.ru
State New
Series "mm/memcg: correct timeout check."
Headers show

Commit Message

Konstantin Khorenko Aug. 8, 2019, 3:02 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.10
------>
commit e74167daa6f70ed6c78e7a2e861e9bf751e8f424
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Aug 8 18:02:39 2019 +0300

    mm/memcg: correct timeout check.
    
    We should use time_before() instead of time_after(), since we want
    true value to repeat the loop before timeout reaches.
    
    Fixes: 6c56498a819e ("mm/memcg: use timeout instead of iteration count to
    determine leak.")
    
    https://jira.sw.ru/browse/PSBM-96889
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 5271921766d3..817299be726f 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4378,7 +4378,7 @@  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) && time_after(jiffies, timeout));
+		 page_counter_read(&memcg->kmem) > 0) && time_before(jiffies, timeout));
 
 	WARN_ONCE((page_counter_read(&memcg->memory) -
 			page_counter_read(&memcg->kmem) > 0),