]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
memory-hotplug: remove memmap of sparse-vmemmap
authorTang Chen <tangchen@cn.fujitsu.com>
Wed, 20 Feb 2013 02:14:18 +0000 (13:14 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 20 Feb 2013 05:52:31 +0000 (16:52 +1100)
Introduce a new API vmemmap_free() to free and remove vmemmap pagetables.
Since pagetable implements are different, each architecture has to provide
its own version of vmemmap_free(), just like vmemmap_populate().

Note:  vmemmap_free() is not implemented for ia64, ppc, s390, and sparc.

Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Wu Jianguo <wujianguo@huawei.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/arm64/mm/mmu.c
arch/ia64/mm/discontig.c
arch/powerpc/mm/init_64.c
arch/s390/mm/vmem.c
arch/sparc/mm/init_64.c
arch/x86/mm/init_64.c
include/linux/mm.h
mm/sparse.c

index f4dd585898c5c36529ea69290ac5baa19bc0dd4b..224b44ab534ee4682ffb004e50c3d92b86a39a85 100644 (file)
@@ -434,4 +434,7 @@ int __meminit vmemmap_populate(struct page *start_page,
        return 0;
 }
 #endif /* CONFIG_ARM64_64K_PAGES */
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
index 731bf84094b64f9caa4d70e4458fd3229a77461e..652fee0979219b6976d697652349138c7b7296a2 100644 (file)
@@ -823,4 +823,7 @@ int __meminit vmemmap_populate(struct page *start_page,
        return vmemmap_populate_basepages(start_page, size, node);
 }
 
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
 #endif
index 42bf082f012489673593f3b0111b960d9e040df3..7e2246fb2f31b72512720d0a0db1808f26942f38 100644 (file)
@@ -298,5 +298,9 @@ int __meminit vmemmap_populate(struct page *start_page,
        return 0;
 }
 
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
+
 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
 
index 79699f46a4434d3d1d8269f185b42a07aeef72fd..e21aaf4f5cb6a75eb09982f9aad752918b3d0776 100644 (file)
@@ -268,6 +268,10 @@ out:
        return ret;
 }
 
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
+
 /*
  * Add memory segment to the segment list if it doesn't overlap with
  * an already present segment.
index 09fa1f87939f077143e2d5008116fd394959d871..02598e69e53346f703f20b6edf3fb3156b608290 100644 (file)
@@ -2230,6 +2230,10 @@ void __meminit vmemmap_populate_print_last(void)
        }
 }
 
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
+
 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
 
 static void prot_init_common(unsigned long page_none,
index 4e58b83e6b2ea41d705fe9d6be1cc0e986f4b1ad..bce016deb97605dca7a10ac53ec13464fb77fd05 100644 (file)
@@ -1348,6 +1348,14 @@ 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)
index d14f7d48edecf627dd77ebb9ecab262046f75a78..d87cef8d093f2624f70202174fe61801970e863b 100644 (file)
@@ -1720,6 +1720,7 @@ 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);
+void vmemmap_free(struct page *memmap, unsigned long nr_pages);
 void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
                                  unsigned long size);
 
index 66f0fd9d79643ce79b9b8dc0857e2cc01e6f4eeb..46f6ea47d9ab36a263fea674c99045fd0cd80c5a 100644 (file)
@@ -615,10 +615,11 @@ static inline struct page *kmalloc_section_memmap(unsigned long pnum, int nid,
 }
 static void __kfree_section_memmap(struct page *memmap, unsigned long nr_pages)
 {
-       return; /* XXX: Not implemented yet */
+       vmemmap_free(memmap, nr_pages);
 }
 static void free_map_bootmem(struct page *memmap, unsigned long nr_pages)
 {
+       vmemmap_free(memmap, nr_pages);
 }
 #else
 static struct page *__kmalloc_section_memmap(unsigned long nr_pages)