[Devel] [PATCH rh7 v2 09/10] mm/mem_cgroup_iter: Cleanup mem_cgroup_iter_load()
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Feb 24 13:48:04 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 5fde291ecfee..22c404cc69ab 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1641,18 +1641,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