[Devel] [PATCH rh7 v2 10/10] mm/mem_cgroup_iter: Drop dead_count related infrastructure
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Feb 24 13:48:05 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 22c404cc69ab..a04fcb16008a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -196,7 +196,6 @@ struct mem_cgroup_reclaim_iter {
* If stored memcg is destroyed, the field is wiped.
*/
struct mem_cgroup *last_visited;
- unsigned long last_dead_count;
/* scan generation, increased every round-trip */
unsigned int generation;
@@ -402,7 +401,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;
@@ -1618,19 +1616,11 @@ static void mem_cgroup_iter_invalidate(struct mem_cgroup *root,
}
}
rcu_read_unlock();
-
- /*
- * 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;
/*
@@ -1658,8 +1648,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.
@@ -1667,7 +1656,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)
@@ -1716,7 +1704,6 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
rcu_read_lock();
while (!memcg) {
struct mem_cgroup_reclaim_iter *uninitialized_var(iter);
- int uninitialized_var(seq);
if (reclaim) {
int nid = zone_to_nid(reclaim->zone);
@@ -1730,14 +1717,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