memory_present() is how each arch/subarch will tell sparsemem and discontigmem where all of its memory is. This is what triggers sparse to go out and create its mappings for the memory, as well as allocate the mem_map[]. By: Andy Whitcroft Signed-off-by: Dave Hansen Signed-off-by: Andrew Morton --- include/linux/mmzone.h | 0 memhotplug-dave/arch/ppc64/mm/numa.c | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff -puN arch/i386/Kconfig~FROM-MM-x86-abstract-discontigmem-setup arch/i386/Kconfig diff -puN arch/i386/kernel/numaq.c~FROM-MM-x86-abstract-discontigmem-setup arch/i386/kernel/numaq.c diff -puN arch/i386/kernel/srat.c~FROM-MM-x86-abstract-discontigmem-setup arch/i386/kernel/srat.c diff -puN arch/i386/mm/discontig.c~FROM-MM-x86-abstract-discontigmem-setup arch/i386/mm/discontig.c diff -puN arch/ppc64/mm/numa.c~FROM-MM-x86-abstract-discontigmem-setup arch/ppc64/mm/numa.c --- memhotplug/arch/ppc64/mm/numa.c~FROM-MM-x86-abstract-discontigmem-setup 2005-03-11 10:52:12.000000000 -0800 +++ memhotplug-dave/arch/ppc64/mm/numa.c 2005-03-11 10:52:12.000000000 -0800 @@ -58,6 +58,17 @@ EXPORT_SYMBOL(numa_memory_lookup_table); EXPORT_SYMBOL(numa_cpumask_lookup_table); EXPORT_SYMBOL(nr_cpus_in_node); +void memory_present(int nid, unsigned long start_pfn, + unsigned long end_pfn) +{ + unsigned long i; + unsigned long start_addr = start << PAGE_SHIFT; + unsigned long end_addr = end << PAGE_SHIFT; + + for (i = start ; i < end; i += MEMORY_INCREMENT) + numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = nid; +} + static inline void map_cpu_to_node(int cpu, int node) { numa_cpu_lookup_table[cpu] = node; @@ -378,9 +389,8 @@ new_range: size / PAGE_SIZE; } - for (i = start ; i < (start+size); i += MEMORY_INCREMENT) - numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = - numa_domain; + memory_present(numa_domain, start >> PAGE_SHIFT, + (start + size) >> PAGE_SHIFT); ranges--; if (ranges) @@ -428,8 +438,7 @@ static void __init setup_nonnuma(void) init_node_data[0].node_start_pfn = 0; init_node_data[0].node_spanned_pages = lmb_end_of_DRAM() / PAGE_SIZE; - for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT) - numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0; + memory_present(0, 0, init_node_data[0].node_spanned_pages); node0_io_hole_size = top_of_ram - total_ram; } diff -puN include/linux/mmzone.h~FROM-MM-x86-abstract-discontigmem-setup include/linux/mmzone.h _