diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 313247e6c503..7b7f4dc05035 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -103,6 +103,8 @@ struct mem_cgroup_per_zone { | |||
103 | */ | 103 | */ |
104 | struct list_head lists[NR_LRU_LISTS]; | 104 | struct list_head lists[NR_LRU_LISTS]; |
105 | unsigned long count[NR_LRU_LISTS]; | 105 | unsigned long count[NR_LRU_LISTS]; |
106 | |||
107 | struct zone_reclaim_stat reclaim_stat; | ||
106 | }; | 108 | }; |
107 | /* Macro for accessing counter */ | 109 | /* Macro for accessing counter */ |
108 | #define MEM_CGROUP_ZSTAT(mz, idx) ((mz)->count[(idx)]) | 110 | #define MEM_CGROUP_ZSTAT(mz, idx) ((mz)->count[(idx)]) |
@@ -458,6 +460,33 @@ unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, | |||
458 | return MEM_CGROUP_ZSTAT(mz, lru); | 460 | return MEM_CGROUP_ZSTAT(mz, lru); |
459 | } | 461 | } |
460 | 462 | ||
463 | struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, | ||
464 | struct zone *zone) | ||
465 | { | ||
466 | int nid = zone->zone_pgdat->node_id; | ||
467 | int zid = zone_idx(zone); | ||
468 | struct mem_cgroup_per_zone *mz = mem_cgroup_zoneinfo(memcg, nid, zid); | ||
469 | |||
470 | return &mz->reclaim_stat; | ||
471 | } | ||
472 | |||
473 | struct zone_reclaim_stat * | ||
474 | mem_cgroup_get_reclaim_stat_from_page(struct page *page) | ||
475 | { | ||
476 | struct page_cgroup *pc; | ||
477 | struct mem_cgroup_per_zone *mz; | ||
478 | |||
479 | if (mem_cgroup_disabled()) | ||
480 | return NULL; | ||
481 | |||
482 | pc = lookup_page_cgroup(page); | ||
483 | mz = page_cgroup_zoneinfo(pc); | ||
484 | if (!mz) | ||
485 | return NULL; | ||
486 | |||
487 | return &mz->reclaim_stat; | ||
488 | } | ||
489 | |||
461 | unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | 490 | unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, |
462 | struct list_head *dst, | 491 | struct list_head *dst, |
463 | unsigned long *scanned, int order, | 492 | unsigned long *scanned, int order, |