aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2012-03-21 19:34:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-21 20:55:00 -0400
commit1eb4927251a4e5ab152e64afb29453547365fde8 (patch)
treee2b51066c91c8a704251dfdfab6b94471206a00f /mm/memcontrol.c
parentd79154bb5223edad407db61f59b9b15b0080ed80 (diff)
memcg: lru_size instead of MEM_CGROUP_ZSTAT
I never understood why we need a MEM_CGROUP_ZSTAT(mz, idx) macro to obscure the LRU counts. For easier searching? So call it lru_size rather than bare count (lru_length sounds better, but would be wrong, since each huge page raises lru_size hugely). Signed-off-by: Hugh Dickins <hughd@google.com> Acked-by: Kirill A. Shutemov <kirill@shutemov.name> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> 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.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e5370db7ad72..6405e78e26e7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -135,7 +135,7 @@ struct mem_cgroup_reclaim_iter {
135 */ 135 */
136struct mem_cgroup_per_zone { 136struct mem_cgroup_per_zone {
137 struct lruvec lruvec; 137 struct lruvec lruvec;
138 unsigned long count[NR_LRU_LISTS]; 138 unsigned long lru_size[NR_LRU_LISTS];
139 139
140 struct mem_cgroup_reclaim_iter reclaim_iter[DEF_PRIORITY + 1]; 140 struct mem_cgroup_reclaim_iter reclaim_iter[DEF_PRIORITY + 1];
141 141
@@ -147,8 +147,6 @@ struct mem_cgroup_per_zone {
147 struct mem_cgroup *memcg; /* Back pointer, we cannot */ 147 struct mem_cgroup *memcg; /* Back pointer, we cannot */
148 /* use container_of */ 148 /* use container_of */
149}; 149};
150/* Macro for accessing counter */
151#define MEM_CGROUP_ZSTAT(mz, idx) ((mz)->count[(idx)])
152 150
153struct mem_cgroup_per_node { 151struct mem_cgroup_per_node {
154 struct mem_cgroup_per_zone zoneinfo[MAX_NR_ZONES]; 152 struct mem_cgroup_per_zone zoneinfo[MAX_NR_ZONES];
@@ -728,7 +726,7 @@ mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, int nid, int zid,
728 726
729 for_each_lru(l) { 727 for_each_lru(l) {
730 if (BIT(l) & lru_mask) 728 if (BIT(l) & lru_mask)
731 ret += MEM_CGROUP_ZSTAT(mz, l); 729 ret += mz->lru_size[l];
732 } 730 }
733 return ret; 731 return ret;
734} 732}
@@ -1077,7 +1075,7 @@ struct lruvec *mem_cgroup_lru_add_list(struct zone *zone, struct page *page,
1077 1075
1078 mz = page_cgroup_zoneinfo(memcg, page); 1076 mz = page_cgroup_zoneinfo(memcg, page);
1079 /* compound_order() is stabilized through lru_lock */ 1077 /* compound_order() is stabilized through lru_lock */
1080 MEM_CGROUP_ZSTAT(mz, lru) += 1 << compound_order(page); 1078 mz->lru_size[lru] += 1 << compound_order(page);
1081 return &mz->lruvec; 1079 return &mz->lruvec;
1082} 1080}
1083 1081
@@ -1105,8 +1103,8 @@ void mem_cgroup_lru_del_list(struct page *page, enum lru_list lru)
1105 VM_BUG_ON(!memcg); 1103 VM_BUG_ON(!memcg);
1106 mz = page_cgroup_zoneinfo(memcg, page); 1104 mz = page_cgroup_zoneinfo(memcg, page);
1107 /* huge page split is done under lru_lock. so, we have no races. */ 1105 /* huge page split is done under lru_lock. so, we have no races. */
1108 VM_BUG_ON(MEM_CGROUP_ZSTAT(mz, lru) < (1 << compound_order(page))); 1106 VM_BUG_ON(mz->lru_size[lru] < (1 << compound_order(page)));
1109 MEM_CGROUP_ZSTAT(mz, lru) -= 1 << compound_order(page); 1107 mz->lru_size[lru] -= 1 << compound_order(page);
1110} 1108}
1111 1109
1112void mem_cgroup_lru_del(struct page *page) 1110void mem_cgroup_lru_del(struct page *page)
@@ -3629,7 +3627,7 @@ static int mem_cgroup_force_empty_list(struct mem_cgroup *memcg,
3629 mz = mem_cgroup_zoneinfo(memcg, node, zid); 3627 mz = mem_cgroup_zoneinfo(memcg, node, zid);
3630 list = &mz->lruvec.lists[lru]; 3628 list = &mz->lruvec.lists[lru];
3631 3629
3632 loop = MEM_CGROUP_ZSTAT(mz, lru); 3630 loop = mz->lru_size[lru];
3633 /* give some margin against EBUSY etc...*/ 3631 /* give some margin against EBUSY etc...*/
3634 loop += 256; 3632 loop += 256;
3635 busy = NULL; 3633 busy = NULL;