Commit a0140c1d authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by Linus Torvalds

[PATCH] remove zone_mem_map

This patch removes zone_mem_map.

pfn_to_page uses pgdat, page_to_pfn uses zone.  page_to_pfn can use pgdat
instead of zone, which is only one user of zone_mem_map.  By modifing it,
we can remove zone_mem_map.
Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Christoph Lameter <christoph@lameter.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0ecd702b
...@@ -83,8 +83,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) ...@@ -83,8 +83,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
pte_t pte; \ pte_t pte; \
unsigned long pfn; \ unsigned long pfn; \
\ \
pfn = ((unsigned long)((page)-page_zone(page)->zone_mem_map)) << 32; \ pfn = page_to_pfn(page) << 32; \
pfn += page_zone(page)->zone_start_pfn << 32; \
pte_val(pte) = pfn | pgprot_val(pgprot); \ pte_val(pte) = pfn | pgprot_val(pgprot); \
\ \
pte; \ pte; \
......
...@@ -47,9 +47,9 @@ extern unsigned long page_to_pfn(struct page *page); ...@@ -47,9 +47,9 @@ extern unsigned long page_to_pfn(struct page *page);
#define page_to_pfn(pg) \ #define page_to_pfn(pg) \
({ struct page *__pg = (pg); \ ({ struct page *__pg = (pg); \
struct zone *__zone = page_zone(__pg); \ struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
(unsigned long)(__pg - __zone->zone_mem_map) + \ (unsigned long)(__pg - __pgdat->node_mem_map) + \
__zone->zone_start_pfn; \ __pgdat->node_start_pfn; \
}) })
#elif defined(CONFIG_SPARSEMEM) #elif defined(CONFIG_SPARSEMEM)
......
...@@ -225,7 +225,6 @@ struct zone { ...@@ -225,7 +225,6 @@ struct zone {
* Discontig memory support fields. * Discontig memory support fields.
*/ */
struct pglist_data *zone_pgdat; struct pglist_data *zone_pgdat;
struct page *zone_mem_map;
/* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
unsigned long zone_start_pfn; unsigned long zone_start_pfn;
......
...@@ -2042,7 +2042,6 @@ static __meminit void init_currently_empty_zone(struct zone *zone, ...@@ -2042,7 +2042,6 @@ static __meminit void init_currently_empty_zone(struct zone *zone,
zone_wait_table_init(zone, size); zone_wait_table_init(zone, size);
pgdat->nr_zones = zone_idx(zone) + 1; pgdat->nr_zones = zone_idx(zone) + 1;
zone->zone_mem_map = pfn_to_page(zone_start_pfn);
zone->zone_start_pfn = zone_start_pfn; zone->zone_start_pfn = zone_start_pfn;
memmap_init(size, pgdat->node_id, zone_idx(zone), zone_start_pfn); memmap_init(size, pgdat->node_id, zone_idx(zone), zone_start_pfn);
...@@ -2768,9 +2767,8 @@ struct page *pfn_to_page(unsigned long pfn) ...@@ -2768,9 +2767,8 @@ struct page *pfn_to_page(unsigned long pfn)
} }
unsigned long page_to_pfn(struct page *page) unsigned long page_to_pfn(struct page *page)
{ {
struct zone *zone = page_zone(page); struct pglist_data *pgdat = NODE_DATA(page_to_nid(page));
return (page - zone->zone_mem_map) + zone->zone_start_pfn; return (page - pgdat->node_mem_map) + pgdat->node_start_pfn;
} }
#elif defined(CONFIG_SPARSEMEM) #elif defined(CONFIG_SPARSEMEM)
struct page *pfn_to_page(unsigned long pfn) struct page *pfn_to_page(unsigned long pfn)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment