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>
This commit is contained in:
parent
bbcab8789d
commit
0197518cd3
8 changed files with 31 additions and 1 deletions
|
@ -434,4 +434,7 @@ int __meminit vmemmap_populate(struct page *start_page,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_ARM64_64K_PAGES */
|
#endif /* CONFIG_ARM64_64K_PAGES */
|
||||||
|
void vmemmap_free(struct page *memmap, unsigned long nr_pages)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif /* CONFIG_SPARSEMEM_VMEMMAP */
|
#endif /* CONFIG_SPARSEMEM_VMEMMAP */
|
||||||
|
|
|
@ -823,4 +823,7 @@ int __meminit vmemmap_populate(struct page *start_page,
|
||||||
return vmemmap_populate_basepages(start_page, size, node);
|
return vmemmap_populate_basepages(start_page, size, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vmemmap_free(struct page *memmap, unsigned long nr_pages)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -298,5 +298,9 @@ int __meminit vmemmap_populate(struct page *start_page,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vmemmap_free(struct page *memmap, unsigned long nr_pages)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SPARSEMEM_VMEMMAP */
|
#endif /* CONFIG_SPARSEMEM_VMEMMAP */
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,10 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
|
||||||
return ret;
|
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
|
* Add memory segment to the segment list if it doesn't overlap with
|
||||||
* an already present segment.
|
* an already present segment.
|
||||||
|
|
|
@ -2236,6 +2236,10 @@ void __meminit vmemmap_populate_print_last(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void vmemmap_free(struct page *memmap, unsigned long nr_pages)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SPARSEMEM_VMEMMAP */
|
#endif /* CONFIG_SPARSEMEM_VMEMMAP */
|
||||||
|
|
||||||
static void prot_init_common(unsigned long page_none,
|
static void prot_init_common(unsigned long page_none,
|
||||||
|
|
|
@ -1011,6 +1011,14 @@ remove_pagetable(unsigned long start, unsigned long end, bool direct)
|
||||||
flush_tlb_all();
|
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
|
static void __meminit
|
||||||
kernel_physical_mapping_remove(unsigned long start, unsigned long end)
|
kernel_physical_mapping_remove(unsigned long start, unsigned long end)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1718,6 +1718,9 @@ int vmemmap_populate_basepages(struct page *start_page,
|
||||||
unsigned long pages, int node);
|
unsigned long pages, int node);
|
||||||
int vmemmap_populate(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_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,
|
void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
|
||||||
unsigned long size);
|
unsigned long size);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
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)
|
static void free_map_bootmem(struct page *memmap, unsigned long nr_pages)
|
||||||
{
|
{
|
||||||
|
vmemmap_free(memmap, nr_pages);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
|
static struct page *__kmalloc_section_memmap(unsigned long nr_pages)
|
||||||
|
|
Loading…
Reference in a new issue