diff options
-rw-r--r-- | include/linux/memcontrol.h | 9 | ||||
-rw-r--r-- | include/linux/mmzone.h | 29 | ||||
-rw-r--r-- | mm/memcontrol.c | 27 | ||||
-rw-r--r-- | mm/page_alloc.c | 8 | ||||
-rw-r--r-- | mm/swap.c | 14 | ||||
-rw-r--r-- | mm/vmscan.c | 5 |
6 files changed, 30 insertions, 62 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 18ea0b7baf32..cfe9050ad8da 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -126,8 +126,6 @@ int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg, | |||
126 | int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); | 126 | int mem_cgroup_select_victim_node(struct mem_cgroup *memcg); |
127 | unsigned long mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, | 127 | unsigned long mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, |
128 | int nid, int zid, unsigned int lrumask); | 128 | int nid, int zid, unsigned int lrumask); |
129 | struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, | ||
130 | struct zone *zone); | ||
131 | struct zone_reclaim_stat* | 129 | struct zone_reclaim_stat* |
132 | mem_cgroup_get_reclaim_stat_from_page(struct page *page); | 130 | mem_cgroup_get_reclaim_stat_from_page(struct page *page); |
133 | extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, | 131 | extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg, |
@@ -356,13 +354,6 @@ mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, int nid, int zid, | |||
356 | return 0; | 354 | return 0; |
357 | } | 355 | } |
358 | 356 | ||
359 | |||
360 | static inline struct zone_reclaim_stat* | ||
361 | mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, struct zone *zone) | ||
362 | { | ||
363 | return NULL; | ||
364 | } | ||
365 | |||
366 | static inline struct zone_reclaim_stat* | 357 | static inline struct zone_reclaim_stat* |
367 | mem_cgroup_get_reclaim_stat_from_page(struct page *page) | 358 | mem_cgroup_get_reclaim_stat_from_page(struct page *page) |
368 | { | 359 | { |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 4871e31ae277..1b89861eedc0 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -185,8 +185,22 @@ static inline int is_unevictable_lru(enum lru_list lru) | |||
185 | return (lru == LRU_UNEVICTABLE); | 185 | return (lru == LRU_UNEVICTABLE); |
186 | } | 186 | } |
187 | 187 | ||
188 | struct zone_reclaim_stat { | ||
189 | /* | ||
190 | * The pageout code in vmscan.c keeps track of how many of the | ||
191 | * mem/swap backed and file backed pages are refeferenced. | ||
192 | * The higher the rotated/scanned ratio, the more valuable | ||
193 | * that cache is. | ||
194 | * | ||
195 | * The anon LRU stats live in [0], file LRU stats in [1] | ||
196 | */ | ||
197 | unsigned long recent_rotated[2]; | ||
198 | unsigned long recent_scanned[2]; | ||
199 | }; | ||
200 | |||
188 | struct lruvec { | 201 | struct lruvec { |
189 | struct list_head lists[NR_LRU_LISTS]; | 202 | struct list_head lists[NR_LRU_LISTS]; |
203 | struct zone_reclaim_stat reclaim_stat; | ||
190 | }; | 204 | }; |
191 | 205 | ||
192 | /* Mask used at gathering information at once (see memcontrol.c) */ | 206 | /* Mask used at gathering information at once (see memcontrol.c) */ |
@@ -313,19 +327,6 @@ enum zone_type { | |||
313 | #error ZONES_SHIFT -- too many zones configured adjust calculation | 327 | #error ZONES_SHIFT -- too many zones configured adjust calculation |
314 | #endif | 328 | #endif |
315 | 329 | ||
316 | struct zone_reclaim_stat { | ||
317 | /* | ||
318 | * The pageout code in vmscan.c keeps track of how many of the | ||
319 | * mem/swap backed and file backed pages are refeferenced. | ||
320 | * The higher the rotated/scanned ratio, the more valuable | ||
321 | * that cache is. | ||
322 | * | ||
323 | * The anon LRU stats live in [0], file LRU stats in [1] | ||
324 | */ | ||
325 | unsigned long recent_rotated[2]; | ||
326 | unsigned long recent_scanned[2]; | ||
327 | }; | ||
328 | |||
329 | struct zone { | 330 | struct zone { |
330 | /* Fields commonly accessed by the page allocator */ | 331 | /* Fields commonly accessed by the page allocator */ |
331 | 332 | ||
@@ -407,8 +408,6 @@ struct zone { | |||
407 | spinlock_t lru_lock; | 408 | spinlock_t lru_lock; |
408 | struct lruvec lruvec; | 409 | struct lruvec lruvec; |
409 | 410 | ||
410 | struct zone_reclaim_stat reclaim_stat; | ||
411 | |||
412 | unsigned long pages_scanned; /* since last reclaim */ | 411 | unsigned long pages_scanned; /* since last reclaim */ |
413 | unsigned long flags; /* zone flags, see below */ | 412 | unsigned long flags; /* zone flags, see below */ |
414 | 413 | ||
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]); |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4fc462b5fcf1..8cbfc38e68ac 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -4410,10 +4410,10 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat, | |||
4410 | zone_pcp_init(zone); | 4410 | zone_pcp_init(zone); |
4411 | for_each_lru(lru) | 4411 | for_each_lru(lru) |
4412 | INIT_LIST_HEAD(&zone->lruvec.lists[lru]); | 4412 | INIT_LIST_HEAD(&zone->lruvec.lists[lru]); |
4413 | zone->reclaim_stat.recent_rotated[0] = 0; | 4413 | zone->lruvec.reclaim_stat.recent_rotated[0] = 0; |
4414 | zone->reclaim_stat.recent_rotated[1] = 0; | 4414 | zone->lruvec.reclaim_stat.recent_rotated[1] = 0; |
4415 | zone->reclaim_stat.recent_scanned[0] = 0; | 4415 | zone->lruvec.reclaim_stat.recent_scanned[0] = 0; |
4416 | zone->reclaim_stat.recent_scanned[1] = 0; | 4416 | zone->lruvec.reclaim_stat.recent_scanned[1] = 0; |
4417 | zap_zone_vm_stats(zone); | 4417 | zap_zone_vm_stats(zone); |
4418 | zone->flags = 0; | 4418 | zone->flags = 0; |
4419 | if (!size) | 4419 | if (!size) |
@@ -312,21 +312,15 @@ void rotate_reclaimable_page(struct page *page) | |||
312 | static void update_page_reclaim_stat(struct zone *zone, struct page *page, | 312 | static void update_page_reclaim_stat(struct zone *zone, struct page *page, |
313 | int file, int rotated) | 313 | int file, int rotated) |
314 | { | 314 | { |
315 | struct zone_reclaim_stat *reclaim_stat = &zone->reclaim_stat; | 315 | struct zone_reclaim_stat *reclaim_stat; |
316 | struct zone_reclaim_stat *memcg_reclaim_stat; | ||
317 | 316 | ||
318 | memcg_reclaim_stat = mem_cgroup_get_reclaim_stat_from_page(page); | 317 | reclaim_stat = mem_cgroup_get_reclaim_stat_from_page(page); |
318 | if (!reclaim_stat) | ||
319 | reclaim_stat = &zone->lruvec.reclaim_stat; | ||
319 | 320 | ||
320 | reclaim_stat->recent_scanned[file]++; | 321 | reclaim_stat->recent_scanned[file]++; |
321 | if (rotated) | 322 | if (rotated) |
322 | reclaim_stat->recent_rotated[file]++; | 323 | reclaim_stat->recent_rotated[file]++; |
323 | |||
324 | if (!memcg_reclaim_stat) | ||
325 | return; | ||
326 | |||
327 | memcg_reclaim_stat->recent_scanned[file]++; | ||
328 | if (rotated) | ||
329 | memcg_reclaim_stat->recent_rotated[file]++; | ||
330 | } | 324 | } |
331 | 325 | ||
332 | static void __activate_page(struct page *page, void *arg) | 326 | static void __activate_page(struct page *page, void *arg) |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 52fac58b4461..e234ada18747 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -149,10 +149,7 @@ static bool global_reclaim(struct scan_control *sc) | |||
149 | 149 | ||
150 | static struct zone_reclaim_stat *get_reclaim_stat(struct mem_cgroup_zone *mz) | 150 | static struct zone_reclaim_stat *get_reclaim_stat(struct mem_cgroup_zone *mz) |
151 | { | 151 | { |
152 | if (!mem_cgroup_disabled()) | 152 | return &mem_cgroup_zone_lruvec(mz->zone, mz->mem_cgroup)->reclaim_stat; |
153 | return mem_cgroup_get_reclaim_stat(mz->mem_cgroup, mz->zone); | ||
154 | |||
155 | return &mz->zone->reclaim_stat; | ||
156 | } | 153 | } |
157 | 154 | ||
158 | static unsigned long zone_nr_lru_pages(struct mem_cgroup_zone *mz, | 155 | static unsigned long zone_nr_lru_pages(struct mem_cgroup_zone *mz, |