aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-alpha/mmzone.h3
-rw-r--r--include/asm-generic/memory_model.h10
-rw-r--r--include/linux/mmzone.h1
-rw-r--r--mm/page_alloc.c6
4 files changed, 8 insertions, 12 deletions
diff --git a/include/asm-alpha/mmzone.h b/include/asm-alpha/mmzone.h
index c9004398f273..192d80c875b0 100644
--- a/include/asm-alpha/mmzone.h
+++ b/include/asm-alpha/mmzone.h
@@ -83,8 +83,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
83 pte_t pte; \ 83 pte_t pte; \
84 unsigned long pfn; \ 84 unsigned long pfn; \
85 \ 85 \
86 pfn = ((unsigned long)((page)-page_zone(page)->zone_mem_map)) << 32; \ 86 pfn = page_to_pfn(page) << 32; \
87 pfn += page_zone(page)->zone_start_pfn << 32; \
88 pte_val(pte) = pfn | pgprot_val(pgprot); \ 87 pte_val(pte) = pfn | pgprot_val(pgprot); \
89 \ 88 \
90 pte; \ 89 pte; \
diff --git a/include/asm-generic/memory_model.h b/include/asm-generic/memory_model.h
index a7bb4978e808..0cfb086dd373 100644
--- a/include/asm-generic/memory_model.h
+++ b/include/asm-generic/memory_model.h
@@ -45,11 +45,11 @@ extern unsigned long page_to_pfn(struct page *page);
45 NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\ 45 NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
46}) 46})
47 47
48#define page_to_pfn(pg) \ 48#define page_to_pfn(pg) \
49({ struct page *__pg = (pg); \ 49({ struct page *__pg = (pg); \
50 struct zone *__zone = page_zone(__pg); \ 50 struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
51 (unsigned long)(__pg - __zone->zone_mem_map) + \ 51 (unsigned long)(__pg - __pgdat->node_mem_map) + \
52 __zone->zone_start_pfn; \ 52 __pgdat->node_start_pfn; \
53}) 53})
54 54
55#elif defined(CONFIG_SPARSEMEM) 55#elif defined(CONFIG_SPARSEMEM)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 0c1c0c0cce65..ace31c515a8c 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -225,7 +225,6 @@ struct zone {
225 * Discontig memory support fields. 225 * Discontig memory support fields.
226 */ 226 */
227 struct pglist_data *zone_pgdat; 227 struct pglist_data *zone_pgdat;
228 struct page *zone_mem_map;
229 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */ 228 /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
230 unsigned long zone_start_pfn; 229 unsigned long zone_start_pfn;
231 230
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 349b328763b7..8dc8f2735d22 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2042,7 +2042,6 @@ static __meminit void init_currently_empty_zone(struct zone *zone,
2042 zone_wait_table_init(zone, size); 2042 zone_wait_table_init(zone, size);
2043 pgdat->nr_zones = zone_idx(zone) + 1; 2043 pgdat->nr_zones = zone_idx(zone) + 1;
2044 2044
2045 zone->zone_mem_map = pfn_to_page(zone_start_pfn);
2046 zone->zone_start_pfn = zone_start_pfn; 2045 zone->zone_start_pfn = zone_start_pfn;
2047 2046
2048 memmap_init(size, pgdat->node_id, zone_idx(zone), zone_start_pfn); 2047 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} 2767}
2769unsigned long page_to_pfn(struct page *page) 2768unsigned long page_to_pfn(struct page *page)
2770{ 2769{
2771 struct zone *zone = page_zone(page); 2770 struct pglist_data *pgdat = NODE_DATA(page_to_nid(page));
2772 return (page - zone->zone_mem_map) + zone->zone_start_pfn; 2771 return (page - pgdat->node_mem_map) + pgdat->node_start_pfn;
2773
2774} 2772}
2775#elif defined(CONFIG_SPARSEMEM) 2773#elif defined(CONFIG_SPARSEMEM)
2776struct page *pfn_to_page(unsigned long pfn) 2774struct page *pfn_to_page(unsigned long pfn)