mm/ARM: use common help functions to free reserved pages
Use common help functions to free reserved pages. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
f3beeb4a51
commit
83db0384a9
@@ -197,24 +197,6 @@ void __init bootmem_init(void)
|
||||
max_pfn = max_low_pfn = max;
|
||||
}
|
||||
|
||||
static inline int free_area(unsigned long pfn, unsigned long end, char *s)
|
||||
{
|
||||
unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10);
|
||||
|
||||
for (; pfn < end; pfn++) {
|
||||
struct page *page = pfn_to_page(pfn);
|
||||
ClearPageReserved(page);
|
||||
init_page_count(page);
|
||||
__free_page(page);
|
||||
pages++;
|
||||
}
|
||||
|
||||
if (size && s)
|
||||
pr_info("Freeing %s memory: %dK\n", s, size);
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
/*
|
||||
* Poison init memory with an undefined instruction (0x0).
|
||||
*/
|
||||
@@ -405,9 +387,7 @@ void __init mem_init(void)
|
||||
void free_initmem(void)
|
||||
{
|
||||
poison_init_mem(__init_begin, __init_end - __init_begin);
|
||||
totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
|
||||
__phys_to_pfn(__pa(__init_end)),
|
||||
"init");
|
||||
free_initmem_default(0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_INITRD
|
||||
@@ -418,9 +398,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
|
||||
{
|
||||
if (!keep_initrd) {
|
||||
poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
|
||||
totalram_pages += free_area(__phys_to_pfn(__pa(start)),
|
||||
__phys_to_pfn(__pa(end)),
|
||||
"initrd");
|
||||
free_reserved_area(start, end, 0, "initrd");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user