Commit 9da83f3f authored by Yafang Shao's avatar Yafang Shao Committed by Linus Torvalds

mm, memcg: clean up reclaim iter array

The mem_cgroup_reclaim_cookie is only used in memcg softlimit reclaim now,
and the priority of the reclaim is always 0.  We don't need to define the
iter in struct mem_cgroup_per_node as an array any more.  That could make
the code more clear and save some space.

Link: http://lkml.kernel.org/r/1569897728-1686-1-git-send-email-laoar.shao@gmail.comSigned-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a1100a74
...@@ -58,7 +58,6 @@ enum mem_cgroup_protection { ...@@ -58,7 +58,6 @@ enum mem_cgroup_protection {
struct mem_cgroup_reclaim_cookie { struct mem_cgroup_reclaim_cookie {
pg_data_t *pgdat; pg_data_t *pgdat;
int priority;
unsigned int generation; unsigned int generation;
}; };
...@@ -126,7 +125,7 @@ struct mem_cgroup_per_node { ...@@ -126,7 +125,7 @@ struct mem_cgroup_per_node {
unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];
struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; struct mem_cgroup_reclaim_iter iter;
struct memcg_shrinker_map __rcu *shrinker_map; struct memcg_shrinker_map __rcu *shrinker_map;
......
...@@ -1052,7 +1052,7 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root, ...@@ -1052,7 +1052,7 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root,
struct mem_cgroup_per_node *mz; struct mem_cgroup_per_node *mz;
mz = mem_cgroup_nodeinfo(root, reclaim->pgdat->node_id); mz = mem_cgroup_nodeinfo(root, reclaim->pgdat->node_id);
iter = &mz->iter[reclaim->priority]; iter = &mz->iter;
if (prev && reclaim->generation != iter->generation) if (prev && reclaim->generation != iter->generation)
goto out_unlock; goto out_unlock;
...@@ -1152,15 +1152,11 @@ static void __invalidate_reclaim_iterators(struct mem_cgroup *from, ...@@ -1152,15 +1152,11 @@ static void __invalidate_reclaim_iterators(struct mem_cgroup *from,
struct mem_cgroup_reclaim_iter *iter; struct mem_cgroup_reclaim_iter *iter;
struct mem_cgroup_per_node *mz; struct mem_cgroup_per_node *mz;
int nid; int nid;
int i;
for_each_node(nid) { for_each_node(nid) {
mz = mem_cgroup_nodeinfo(from, nid); mz = mem_cgroup_nodeinfo(from, nid);
for (i = 0; i <= DEF_PRIORITY; i++) { iter = &mz->iter;
iter = &mz->iter[i]; cmpxchg(&iter->position, dead_memcg, NULL);
cmpxchg(&iter->position,
dead_memcg, NULL);
}
} }
} }
...@@ -1705,7 +1701,6 @@ static int mem_cgroup_soft_reclaim(struct mem_cgroup *root_memcg, ...@@ -1705,7 +1701,6 @@ static int mem_cgroup_soft_reclaim(struct mem_cgroup *root_memcg,
unsigned long nr_scanned; unsigned long nr_scanned;
struct mem_cgroup_reclaim_cookie reclaim = { struct mem_cgroup_reclaim_cookie reclaim = {
.pgdat = pgdat, .pgdat = pgdat,
.priority = 0,
}; };
excess = soft_limit_excess(root_memcg); excess = soft_limit_excess(root_memcg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment