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.
Unified · Split
| @@ -58,7 +58,6 @@ enum mem_cgroup_protection { · 57 unmodified lines | ||
| 58 | 58 | |
| 59 | 59 | struct mem_cgroup_reclaim_cookie { |
| 60 | 60 | pg_data_t *pgdat; |
| 61 | − int priority; | |
| 62 | 61 | unsigned int generation; |
| 63 | 62 | }; |
| 64 | 63 | |
| @@ -126,7 +125,7 @@ struct mem_cgroup_per_node { · 61 unmodified lines | ||
| 126 | 125 | |
| 127 | 126 | unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS]; |
| 128 | 127 | |
| 129 | − struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; | |
| 128 | + struct mem_cgroup_reclaim_iter iter; | |
| 130 | 129 | |
| 131 | 130 | struct memcg_shrinker_map __rcu *shrinker_map; |
| 132 | 131 | |
| @@ -1052,7 +1052,7 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root, · 1051 unmodified lines | ||
| 1052 | 1052 | struct mem_cgroup_per_node *mz; |
| 1053 | 1053 | |
| 1054 | 1054 | mz = mem_cgroup_nodeinfo(root, reclaim->pgdat->node_id); |
| 1055 | − iter = &mz->iter[reclaim->priority]; | |
| 1055 | + iter = &mz->iter; | |
| 1056 | 1056 | |
| 1057 | 1057 | if (prev && reclaim->generation != iter->generation) |
| 1058 | 1058 | goto out_unlock; |
| @@ -1152,15 +1152,11 @@ static void __invalidate_reclaim_iterators(struct mem_cgroup *from, · 93 unmodified lines | ||
| 1152 | 1152 | struct mem_cgroup_reclaim_iter *iter; |
| 1153 | 1153 | struct mem_cgroup_per_node *mz; |
| 1154 | 1154 | int nid; |
| 1155 | − int i; | |
| 1156 | 1155 | |
| 1157 | 1156 | for_each_node(nid) { |
| 1158 | 1157 | mz = mem_cgroup_nodeinfo(from, nid); |
| 1159 | − for (i = 0; i <= DEF_PRIORITY; i++) { | |
| 1160 | − iter = &mz->iter[i]; | |
| 1161 | − cmpxchg(&iter->position, | |
| 1162 | − dead_memcg, NULL); | |
| 1163 | − } | |
| 1158 | + iter = &mz->iter; | |
| 1159 | + cmpxchg(&iter->position, dead_memcg, NULL); | |
| 1164 | 1160 | } |
| 1165 | 1161 | } |
| 1166 | 1162 | |
| @@ -1705,7 +1701,6 @@ static int mem_cgroup_soft_reclaim(struct mem_cgroup *root_memcg, · 538 unmodified lines | ||
| 1705 | 1701 | unsigned long nr_scanned; |
| 1706 | 1702 | struct mem_cgroup_reclaim_cookie reclaim = { |
| 1707 | 1703 | .pgdat = pgdat, |
| 1708 | − .priority = 0, | |
| 1709 | 1704 | }; |
| 1710 | 1705 | |
| 1711 | 1706 | excess = soft_limit_excess(root_memcg); |