Fix crash with FLAT_MEMORY and ARCH_PFN_OFFSET != 0
authorThomas Bogendoerfer <[email protected]>
Tue, 8 Jan 2008 23:33:11 +0000 (15:33 -0800)
committerLinus Torvalds <[email protected]>
Wed, 9 Jan 2008 00:10:36 +0000 (16:10 -0800)
When using FLAT_MEMORY and ARCH_PFN_OFFSET is not 0, the kernel crashes in
memmap_init_zone().  This bug got introduced by commit
c713216deebd95d2b0ab38fef8bb2361c0180c2d

Signed-off-by: Thomas Bogendoerfer <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Cc: Bob Picco <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: "Keith Mannthey" <[email protected]>
Cc: "Luck, Tony" <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Yasunori Goto <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c

index d73bfad1c32f2e2254aaa1f47de3bda7db0b8b88..e1028fae3ebbd2644628316cc08f94fa55ae0dad 100644 (file)
@@ -3438,7 +3438,7 @@ static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat)
                mem_map = NODE_DATA(0)->node_mem_map;
 #ifdef CONFIG_ARCH_POPULATES_NODE_MAP
                if (page_to_pfn(mem_map) != pgdat->node_start_pfn)
-                       mem_map -= pgdat->node_start_pfn;
+                       mem_map -= (pgdat->node_start_pfn - ARCH_PFN_OFFSET);
 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
        }
 #endif