From: KAMEZAWA Hiroyuki Add support for statically allocated virtual mem_map. (means virtual address of mem_map array is defined statically.) This removes reference to *(&mem_map). Signed-off-by: KAMEZAWA Hiroyuki Cc: Andy Whitcroft Cc: Dave Hansen Cc: Martin Bligh Cc: "Luck, Tony" Cc: Christoph Lameter Signed-off-by: Andrew Morton --- include/linux/mmzone.h | 5 +++++ mm/Kconfig | 4 ++++ mm/memory.c | 2 ++ 3 files changed, 11 insertions(+) diff -puN include/linux/mmzone.h~virtual-memmap-on-sparsemem-v3-static-virtual include/linux/mmzone.h --- a/include/linux/mmzone.h~virtual-memmap-on-sparsemem-v3-static-virtual +++ a/include/linux/mmzone.h @@ -693,8 +693,13 @@ extern int __section_nr(struct mem_secti #if (((BITS_PER_LONG/4) * PAGES_PER_SECTION) % PAGE_SIZE) != 0 #error "PAGE_SIZE/SECTION_SIZE relationship is not suitable for vmem_map" #endif +#ifdef CONFIG_SPARSEMEM_VMEMMAP_STATIC +#include +extern struct page mem_map[]; +#else extern struct page* mem_map; #endif +#endif static inline struct page *__section_mem_map_addr(struct mem_section *section) { diff -puN mm/Kconfig~virtual-memmap-on-sparsemem-v3-static-virtual mm/Kconfig --- a/mm/Kconfig~virtual-memmap-on-sparsemem-v3-static-virtual +++ a/mm/Kconfig @@ -121,6 +121,10 @@ config SPARSEMEM_VMEMMAP But this consumes huge amount of virtual memory(not physical). This option is selectable only if your arch supports it. +config SPARSEMEM_VMEMMAP_STATIC + def_bool y + depends on ARCH_SPARSEMEM_VMEMMAP_STATIC + # eventually, we can have this option just 'select SPARSEMEM' config MEMORY_HOTPLUG bool "Allow for memory hot-add" diff -puN mm/memory.c~virtual-memmap-on-sparsemem-v3-static-virtual mm/memory.c --- a/mm/memory.c~virtual-memmap-on-sparsemem-v3-static-virtual +++ a/mm/memory.c @@ -71,7 +71,9 @@ EXPORT_SYMBOL(mem_map); #ifdef CONFIG_SPARSEMEM_VMEMMAP /* for the virtual mem_map */ +#ifndef CONFIG_SPARSEMEM_VMEMMAP_STATIC struct page *mem_map; +#endif EXPORT_SYMBOL(mem_map); #endif _