[Devel] [PATCH rh7 v3 8/9] mm/mem_cgroup_iter: Cleanup mem_cgroup_iter_load()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Feb 24 20:44:07 MSK 2021


No functional changes here.

https://jira.sw.ru/browse/PSBM-123655

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/memcontrol.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 96fdce58eacc..3613c01d6bd2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1653,18 +1653,17 @@ mem_cgroup_iter_load(struct mem_cgroup_reclaim_iter *iter,
 	 * offlining.  The RCU lock ensures the object won't be
 	 * released, tryget will fail if we lost the race.
 	 */
-		position = rcu_dereference(iter->last_visited);
+	position = rcu_dereference(iter->last_visited);
+
+	/*
+	 * We cannot take a reference to root because we might race
+	 * with root removal and returning NULL would end up in
+	 * an endless loop on the iterator user level when root
+	 * would be returned all the time.
+	 */
+	if (position && position != root && !css_tryget(&position->css))
+		position = NULL;
 
-		/*
-		 * We cannot take a reference to root because we might race
-		 * with root removal and returning NULL would end up in
-		 * an endless loop on the iterator user level when root
-		 * would be returned all the time.
-		*/
-		if (position && position != root &&
-				!css_tryget(&position->css))
-
-			position = NULL;
 	return position;
 }
 
-- 
2.24.3



More information about the Devel mailing list