[Devel] [PATCH rh7] mm/memcg: correct timeout check.

Andrey Ryabinin aryabinin at virtuozzo.com
Thu Aug 8 12:32:00 MSK 2019


We should use time_before() instead of time_after(), since we want
true value to repeat the loop before timeout reaches.

https://jira.sw.ru/browse/PSBM-96889
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 884f1596bb24..7a0b8815bd00 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4377,7 +4377,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),
-- 
2.21.0



More information about the Devel mailing list