Commit 0197518cd3672029618a16a57597946a094ac7a8
Committed by
Linus Torvalds
1 parent
bbcab8789d
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
memory-hotplug: remove memmap of sparse-vmemmap
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. [mhocko@suse.cz: fix implicit declaration of remove_pagetable] 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: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 8 changed files with 31 additions and 1 deletions Side-by-side Diff
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
... | ... | @@ -1011,6 +1011,14 @@ |
1011 | 1011 | flush_tlb_all(); |
1012 | 1012 | } |
1013 | 1013 | |
1014 | +void __ref vmemmap_free(struct page *memmap, unsigned long nr_pages) | |
1015 | +{ | |
1016 | + unsigned long start = (unsigned long)memmap; | |
1017 | + unsigned long end = (unsigned long)(memmap + nr_pages); | |
1018 | + | |
1019 | + remove_pagetable(start, end, false); | |
1020 | +} | |
1021 | + | |
1014 | 1022 | static void __meminit |
1015 | 1023 | kernel_physical_mapping_remove(unsigned long start, unsigned long end) |
1016 | 1024 | { |
include/linux/mm.h
... | ... | @@ -1718,6 +1718,9 @@ |
1718 | 1718 | unsigned long pages, int node); |
1719 | 1719 | int vmemmap_populate(struct page *start_page, unsigned long pages, int node); |
1720 | 1720 | void vmemmap_populate_print_last(void); |
1721 | +#ifdef CONFIG_MEMORY_HOTPLUG | |
1722 | +void vmemmap_free(struct page *memmap, unsigned long nr_pages); | |
1723 | +#endif | |
1721 | 1724 | void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, |
1722 | 1725 | unsigned long size); |
1723 | 1726 |
mm/sparse.c
... | ... | @@ -615,10 +615,11 @@ |
615 | 615 | } |
616 | 616 | static void __kfree_section_memmap(struct page *memmap, unsigned long nr_pages) |
617 | 617 | { |
618 | - return; /* XXX: Not implemented yet */ | |
618 | + vmemmap_free(memmap, nr_pages); | |
619 | 619 | } |
620 | 620 | static void free_map_bootmem(struct page *memmap, unsigned long nr_pages) |
621 | 621 | { |
622 | + vmemmap_free(memmap, nr_pages); | |
622 | 623 | } |
623 | 624 | #else |
624 | 625 | static struct page *__kmalloc_section_memmap(unsigned long nr_pages) |