From 5c299ae21919e5e28829e90649c5097feccf0cb2 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Wed, 20 Feb 2013 13:14:18 +1100 Subject: [PATCH] memory-hotplug-remove-memmap-of-sparse-vmemmap-fix Defconfig for x86_64 complains: arch/x86/mm/init_64.c: In function `vmemmap_free': arch/x86/mm/init_64.c:1317: error: implicit declaration of function `remove_pagetable' vmemmap_free is only used for CONFIG_MEMORY_HOTPLUG so let's move it inside ifdef Signed-off-by: Michal Hocko Tested-by: Lin Feng Signed-off-by: Andrew Morton --- arch/x86/mm/init_64.c | 16 ++++++++-------- include/linux/mm.h | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index bce016deb976..474e28f10815 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1011,6 +1011,14 @@ remove_pagetable(unsigned long start, unsigned long end, bool direct) flush_tlb_all(); } +void __ref vmemmap_free(struct page *memmap, unsigned long nr_pages) +{ + unsigned long start = (unsigned long)memmap; + unsigned long end = (unsigned long)(memmap + nr_pages); + + remove_pagetable(start, end, false); +} + static void __meminit kernel_physical_mapping_remove(unsigned long start, unsigned long end) { @@ -1348,14 +1356,6 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node) return 0; } -void __ref vmemmap_free(struct page *memmap, unsigned long nr_pages) -{ - unsigned long start = (unsigned long)memmap; - unsigned long end = (unsigned long)(memmap + nr_pages); - - remove_pagetable(start, end, false); -} - #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE) void register_page_bootmem_memmap(unsigned long section_nr, struct page *start_page, unsigned long size) diff --git a/include/linux/mm.h b/include/linux/mm.h index d87cef8d093f..5ca9b9a588e1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1720,7 +1720,9 @@ int vmemmap_populate_basepages(struct page *start_page, unsigned long pages, int node); int vmemmap_populate(struct page *start_page, unsigned long pages, int node); void vmemmap_populate_print_last(void); +#ifdef CONFIG_MEMORY_HOTPLUG void vmemmap_free(struct page *memmap, unsigned long nr_pages); +#endif void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, unsigned long size); -- 2.39.5