aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2012-05-29 18:06:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:26 -0400
commit7f5e86c2ccc1480946d2c869d7f7d5278e828092 (patch)
tree704612422963868042c9d240b4a395bd7bce8469 /mm
parent9e3b2f8cd340e13353a44c9a34caef2848131ed7 (diff)
mm: add link from struct lruvec to struct zone
This is the first stage of struct mem_cgroup_zone removal. Further patches replace struct mem_cgroup_zone with a pointer to struct lruvec. If CONFIG_CGROUP_MEM_RES_CTLR=n lruvec_zone() is just container_of(). Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Cc: Mel Gorman <mel@csn.ul.ie> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c4
-rw-r--r--mm/mmzone.c14
-rw-r--r--mm/page_alloc.c8
3 files changed, 16 insertions, 10 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a8abf919c70a..39b2c14f1509 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4738,7 +4738,6 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node)
4738{ 4738{
4739 struct mem_cgroup_per_node *pn; 4739 struct mem_cgroup_per_node *pn;
4740 struct mem_cgroup_per_zone *mz; 4740 struct mem_cgroup_per_zone *mz;
4741 enum lru_list lru;
4742 int zone, tmp = node; 4741 int zone, tmp = node;
4743 /* 4742 /*
4744 * This routine is called against possible nodes. 4743 * This routine is called against possible nodes.
@@ -4756,8 +4755,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node)
4756 4755
4757 for (zone = 0; zone < MAX_NR_ZONES; zone++) { 4756 for (zone = 0; zone < MAX_NR_ZONES; zone++) {
4758 mz = &pn->zoneinfo[zone]; 4757 mz = &pn->zoneinfo[zone];
4759 for_each_lru(lru) 4758 lruvec_init(&mz->lruvec, &NODE_DATA(node)->node_zones[zone]);
4760 INIT_LIST_HEAD(&mz->lruvec.lists[lru]);
4761 mz->usage_in_excess = 0; 4759 mz->usage_in_excess = 0;
4762 mz->on_tree = false; 4760 mz->on_tree = false;
4763 mz->memcg = memcg; 4761 mz->memcg = memcg;
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 7cf7b7ddc7c5..6830eab5bf09 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -86,3 +86,17 @@ int memmap_valid_within(unsigned long pfn,
86 return 1; 86 return 1;
87} 87}
88#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ 88#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
89
90void lruvec_init(struct lruvec *lruvec, struct zone *zone)
91{
92 enum lru_list lru;
93
94 memset(lruvec, 0, sizeof(struct lruvec));
95
96 for_each_lru(lru)
97 INIT_LIST_HEAD(&lruvec->lists[lru]);
98
99#ifdef CONFIG_CGROUP_MEM_RES_CTLR
100 lruvec->zone = zone;
101#endif
102}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 8cbfc38e68ac..6092f331b32e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4358,7 +4358,6 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
4358 for (j = 0; j < MAX_NR_ZONES; j++) { 4358 for (j = 0; j < MAX_NR_ZONES; j++) {
4359 struct zone *zone = pgdat->node_zones + j; 4359 struct zone *zone = pgdat->node_zones + j;
4360 unsigned long size, realsize, memmap_pages; 4360 unsigned long size, realsize, memmap_pages;
4361 enum lru_list lru;
4362 4361
4363 size = zone_spanned_pages_in_node(nid, j, zones_size); 4362 size = zone_spanned_pages_in_node(nid, j, zones_size);
4364 realsize = size - zone_absent_pages_in_node(nid, j, 4363 realsize = size - zone_absent_pages_in_node(nid, j,
@@ -4408,12 +4407,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat,
4408 zone->zone_pgdat = pgdat; 4407 zone->zone_pgdat = pgdat;
4409 4408
4410 zone_pcp_init(zone); 4409 zone_pcp_init(zone);
4411 for_each_lru(lru) 4410 lruvec_init(&zone->lruvec, zone);
4412 INIT_LIST_HEAD(&zone->lruvec.lists[lru]);
4413 zone->lruvec.reclaim_stat.recent_rotated[0] = 0;
4414 zone->lruvec.reclaim_stat.recent_rotated[1] = 0;
4415 zone->lruvec.reclaim_stat.recent_scanned[0] = 0;
4416 zone->lruvec.reclaim_stat.recent_scanned[1] = 0;
4417 zap_zone_vm_stats(zone); 4411 zap_zone_vm_stats(zone);
4418 zone->flags = 0; 4412 zone->flags = 0;
4419 if (!size) 4413 if (!size)