[Devel] [PATCH rh7 v4 9/9] mm/mem_cgroup_iter: Drop dead_count related infrastructure
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Feb 24 21:55:41 MSK 2021
As we now have stable and reliable iter->last_visited,
don't need to save/compare number of destroyed cgroups.
https://jira.sw.ru/browse/PSBM-123655
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
mm/memcontrol.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3e8607c62035..ca6ffe6fcafc 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -199,7 +199,6 @@ struct mem_cgroup_reclaim_iter {
* protection scheme.
*/
struct mem_cgroup __rcu *last_visited;
- unsigned long last_dead_count;
/* scan generation, increased every round-trip */
unsigned int generation;
@@ -405,7 +404,6 @@ struct mem_cgroup {
spinlock_t pcp_counter_lock;
atomic_long_t oom;
- atomic_t dead_count;
#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_INET)
struct tcp_memcontrol tcp_mem;
struct udp_memcontrol udp_mem;
@@ -1630,19 +1628,11 @@ static void mem_cgroup_iter_invalidate(struct mem_cgroup *root,
}
}
}
-
- /*
- * When a group in the hierarchy below root is destroyed, the
- * hierarchy iterator can no longer be trusted since it might
- * have pointed to the destroyed group. Invalidate it.
- */
- atomic_inc(&root->dead_count);
}
static struct mem_cgroup *
mem_cgroup_iter_load(struct mem_cgroup_reclaim_iter *iter,
- struct mem_cgroup *root,
- int *sequence)
+ struct mem_cgroup *root)
{
struct mem_cgroup *position = NULL;
/*
@@ -1670,8 +1660,7 @@ mem_cgroup_iter_load(struct mem_cgroup_reclaim_iter *iter,
static void mem_cgroup_iter_update(struct mem_cgroup_reclaim_iter *iter,
struct mem_cgroup *last_visited,
struct mem_cgroup *new_position,
- struct mem_cgroup *root,
- int sequence)
+ struct mem_cgroup *root)
{
/*
* The position saved in 'last_visited' is always valid.
@@ -1679,7 +1668,6 @@ static void mem_cgroup_iter_update(struct mem_cgroup_reclaim_iter *iter,
* 'last_visited' is NULLed.
*/
rcu_assign_pointer(iter->last_visited, new_position);
- iter->last_dead_count = sequence;
/* root reference counting symmetric to mem_cgroup_iter_load */
if (last_visited && last_visited != root)
@@ -1788,7 +1776,6 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
rcu_read_lock_sched();
while (!memcg) {
struct mem_cgroup_reclaim_iter *uninitialized_var(iter);
- int uninitialized_var(seq);
if (reclaim) {
int nid = zone_to_nid(reclaim->zone);
@@ -1802,14 +1789,13 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
goto out_unlock;
}
- last_visited = mem_cgroup_iter_load(iter, root, &seq);
+ last_visited = mem_cgroup_iter_load(iter, root);
}
memcg = __mem_cgroup_iter_next(root, last_visited);
if (reclaim) {
- mem_cgroup_iter_update(iter, last_visited, memcg, root,
- seq);
+ mem_cgroup_iter_update(iter, last_visited, memcg, root);
if (!memcg)
iter->generation++;
--
2.24.3
More information about the Devel
mailing list