diff options
author | Hugh Dickins <hughd@google.com> | 2012-05-29 18:06:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:25 -0400 |
commit | 89abfab133ef1f5902abafb744df72793213ac19 (patch) | |
tree | 29df29e2a34a0af3649417d2e430480c7e7e5fa1 /mm/memcontrol.c | |
parent | c3c787e8c38557ccf44c670d73aebe630a2b1479 (diff) |
mm/memcg: move reclaim_stat into lruvec
With mem_cgroup_disabled() now explicit, it becomes clear that the
zone_reclaim_stat structure actually belongs in lruvec, per-zone when
memcg is disabled but per-memcg per-zone when it's enabled.
We can delete mem_cgroup_get_reclaim_stat(), and change
update_page_reclaim_stat() to update just the one set of stats, the one
which get_scan_count() will actually use.
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Reviewed-by: Minchan Kim <minchan@kernel.org>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 30f938c86453..00c8898dbb81 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -138,7 +138,6 @@ struct mem_cgroup_per_zone { | |||
138 | 138 | ||
139 | struct mem_cgroup_reclaim_iter reclaim_iter[DEF_PRIORITY + 1]; | 139 | struct mem_cgroup_reclaim_iter reclaim_iter[DEF_PRIORITY + 1]; |
140 | 140 | ||
141 | struct zone_reclaim_stat reclaim_stat; | ||
142 | struct rb_node tree_node; /* RB tree node */ | 141 | struct rb_node tree_node; /* RB tree node */ |
143 | unsigned long long usage_in_excess;/* Set to the value by which */ | 142 | unsigned long long usage_in_excess;/* Set to the value by which */ |
144 | /* the soft limit is exceeded*/ | 143 | /* the soft limit is exceeded*/ |
@@ -1243,16 +1242,6 @@ int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg, struct zone *zone) | |||
1243 | return (active > inactive); | 1242 | return (active > inactive); |
1244 | } | 1243 | } |
1245 | 1244 | ||
1246 | struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, | ||
1247 | struct zone *zone) | ||
1248 | { | ||
1249 | int nid = zone_to_nid(zone); | ||
1250 | int zid = zone_idx(zone); | ||
1251 | struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid); | ||
1252 | |||
1253 | return &mz->reclaim_stat; | ||
1254 | } | ||
1255 | |||
1256 | struct zone_reclaim_stat * | 1245 | struct zone_reclaim_stat * |
1257 | mem_cgroup_get_reclaim_stat_from_page(struct page *page) | 1246 | mem_cgroup_get_reclaim_stat_from_page(struct page *page) |
1258 | { | 1247 | { |
@@ -1268,7 +1257,7 @@ mem_cgroup_get_reclaim_stat_from_page(struct page *page) | |||
1268 | /* Ensure pc->mem_cgroup is visible after reading PCG_USED. */ | 1257 | /* Ensure pc->mem_cgroup is visible after reading PCG_USED. */ |
1269 | smp_rmb(); | 1258 | smp_rmb(); |
1270 | mz = page_cgroup_zoneinfo(pc->mem_cgroup, page); | 1259 | mz = page_cgroup_zoneinfo(pc->mem_cgroup, page); |
1271 | return &mz->reclaim_stat; | 1260 | return &mz->lruvec.reclaim_stat; |
1272 | } | 1261 | } |
1273 | 1262 | ||
1274 | #define mem_cgroup_from_res_counter(counter, member) \ | 1263 | #define mem_cgroup_from_res_counter(counter, member) \ |
@@ -4216,21 +4205,19 @@ static int mem_control_stat_show(struct cgroup *cont, struct cftype *cft, | |||
4216 | { | 4205 | { |
4217 | int nid, zid; | 4206 | int nid, zid; |
4218 | struct mem_cgroup_per_zone *mz; | 4207 | struct mem_cgroup_per_zone *mz; |
4208 | struct zone_reclaim_stat *rstat; | ||
4219 | unsigned long recent_rotated[2] = {0, 0}; | 4209 | unsigned long recent_rotated[2] = {0, 0}; |
4220 | unsigned long recent_scanned[2] = {0, 0}; | 4210 | unsigned long recent_scanned[2] = {0, 0}; |
4221 | 4211 | ||
4222 | for_each_online_node(nid) | 4212 | for_each_online_node(nid) |
4223 | for (zid = 0; zid < MAX_NR_ZONES; zid++) { | 4213 | for (zid = 0; zid < MAX_NR_ZONES; zid++) { |
4224 | mz = mem_cgroup_zoneinfo(memcg, nid, zid); | 4214 | mz = mem_cgroup_zoneinfo(memcg, nid, zid); |
4215 | rstat = &mz->lruvec.reclaim_stat; | ||
4225 | 4216 | ||
4226 | recent_rotated[0] += | 4217 | recent_rotated[0] += rstat->recent_rotated[0]; |
4227 | mz->reclaim_stat.recent_rotated[0]; | 4218 | recent_rotated[1] += rstat->recent_rotated[1]; |
4228 | recent_rotated[1] += | 4219 | recent_scanned[0] += rstat->recent_scanned[0]; |
4229 | mz->reclaim_stat.recent_rotated[1]; | 4220 | recent_scanned[1] += rstat->recent_scanned[1]; |
4230 | recent_scanned[0] += | ||
4231 | mz->reclaim_stat.recent_scanned[0]; | ||
4232 | recent_scanned[1] += | ||
4233 | mz->reclaim_stat.recent_scanned[1]; | ||
4234 | } | 4221 | } |
4235 | cb->fill(cb, "recent_rotated_anon", recent_rotated[0]); | 4222 | cb->fill(cb, "recent_rotated_anon", recent_rotated[0]); |
4236 | cb->fill(cb, "recent_rotated_file", recent_rotated[1]); | 4223 | cb->fill(cb, "recent_rotated_file", recent_rotated[1]); |