]> err.no Git - linux-2.6/commitdiff
[PATCH] remove zone_mem_map
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Mon, 27 Mar 2006 09:15:55 +0000 (01:15 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 27 Mar 2006 16:44:47 +0000 (08:44 -0800)
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: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Christoph Lameter <christoph@lameter.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-alpha/mmzone.h
include/asm-generic/memory_model.h
include/linux/mmzone.h
mm/page_alloc.c

index c9004398f27380457d5113b1d6a0b558575e771d..192d80c875b06479ff4670693914b9e591600c5c 100644 (file)
@@ -83,8 +83,7 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
        pte_t pte;                                                           \
        unsigned long pfn;                                                   \
                                                                             \
-       pfn = ((unsigned long)((page)-page_zone(page)->zone_mem_map)) << 32; \
-       pfn += page_zone(page)->zone_start_pfn << 32;                        \
+       pfn = page_to_pfn(page) << 32; \
        pte_val(pte) = pfn | pgprot_val(pgprot);                             \
                                                                             \
        pte;                                                                 \
index a7bb4978e808c1d2e7c1c77b568fa3184ee29533..0cfb086dd3736e5a5bf5ed4ebe4cef1bc694f5df 100644 (file)
@@ -45,11 +45,11 @@ extern unsigned long page_to_pfn(struct page *page);
        NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
 })
 
-#define page_to_pfn(pg)                        \
-({     struct page *__pg = (pg);               \
-       struct zone *__zone = page_zone(__pg);  \
-       (unsigned long)(__pg - __zone->zone_mem_map) +  \
-        __zone->zone_start_pfn;                        \
+#define page_to_pfn(pg)                                                        \
+({     struct page *__pg = (pg);                                       \
+       struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg));     \
+       (unsigned long)(__pg - __pgdat->node_mem_map) +                 \
+        __pgdat->node_start_pfn;                                       \
 })
 
 #elif defined(CONFIG_SPARSEMEM)
index 0c1c0c0cce653d8ee4f0d6df7bc68c02964fb940..ace31c515a8cb1b59c6dcf346bb3e25ec61b8e94 100644 (file)
@@ -225,7 +225,6 @@ struct zone {
         * Discontig memory support fields.
         */
        struct pglist_data      *zone_pgdat;
-       struct page             *zone_mem_map;
        /* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
        unsigned long           zone_start_pfn;
 
index 349b328763b779d6bec3854780d4da1a8627956d..8dc8f2735d224e26d64e7bd6971d23f4585bece9 100644 (file)
@@ -2042,7 +2042,6 @@ static __meminit void init_currently_empty_zone(struct zone *zone,
        zone_wait_table_init(zone, size);
        pgdat->nr_zones = zone_idx(zone) + 1;
 
-       zone->zone_mem_map = pfn_to_page(zone_start_pfn);
        zone->zone_start_pfn = 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)
 }
 unsigned long page_to_pfn(struct page *page)
 {
-       struct zone *zone = page_zone(page);
-       return (page - zone->zone_mem_map) + zone->zone_start_pfn;
-
+       struct pglist_data *pgdat = NODE_DATA(page_to_nid(page));
+       return (page - pgdat->node_mem_map) + pgdat->node_start_pfn;
 }
 #elif defined(CONFIG_SPARSEMEM)
 struct page *pfn_to_page(unsigned long pfn)