From: Andy Whitcroft <[email protected]>
The FLATMEM memory model assumes that memory is in one contigious area
based at pfn 0. If we initialise node 0 to start at any other offset we
will incorrectly map pfn's to the wrong struct page *. The key to the
memory model is the contigious nature of the memory not the location of it.
Relax the requirement for the area to start at 0.
page_alloc.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
Signed-off-by: Andy Whitcroft <[email protected]>
Acked-by: Mel Gorman <[email protected]>
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc4-mm1-101-bob-node-alignment/mm/page_alloc.c linux-2.6.17-rc4-mm1-102-FLATMEM-relax-requirement-for-memory-to-start-at-pfn-0/mm/page_alloc.c
--- linux-2.6.17-rc4-mm1-101-bob-node-alignment/mm/page_alloc.c 2006-05-18 17:58:10.000000000 +0100
+++ linux-2.6.17-rc4-mm1-102-FLATMEM-relax-requirement-for-memory-to-start-at-pfn-0/mm/page_alloc.c 2006-05-18 19:14:44.000000000 +0100
@@ -2477,15 +2477,16 @@ static void __meminit free_area_init_cor
static void __init alloc_node_mem_map(struct pglist_data *pgdat)
{
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
+ struct page *map = pgdat->node_mem_map;
+
/* Skip empty nodes */
if (!pgdat->node_spanned_pages)
return;
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
/* ia64 gets its own node_mem_map, before this, without bootmem */
- if (!pgdat->node_mem_map) {
+ if (!map) {
unsigned long size, start, end;
- struct page *map;
/*
* The zone's endpoints aren't required to be MAX_ORDER
@@ -2500,13 +2501,21 @@ static void __init alloc_node_mem_map(st
if (!map)
map = alloc_bootmem_node(pgdat, size);
pgdat->node_mem_map = map + (pgdat->node_start_pfn - start);
+
+ /*
+ * With FLATMEM the global mem_map is used. This is assumed
+ * to be based at pfn 0 such that 'pfn = page* - mem_map'
+ * is true. Adjust map relative to node_mem_map to
+ * maintain this relationship.
+ */
+ map -= pgdat->node_start_pfn;
}
#ifdef CONFIG_FLATMEM
/*
* With no DISCONTIG, the global mem_map is just set as node 0's
*/
if (pgdat == NODE_DATA(0))
- mem_map = NODE_DATA(0)->node_mem_map;
+ mem_map = map;
#endif
#endif /* CONFIG_FLAT_NODE_MEM_MAP */
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]