mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-03 09:26:48 +07:00
Blackfin arch: combine the common code of free_initrd_mem and free_initmem
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
This commit is contained in:
parent
5610db61cf
commit
1d1894749c
@ -168,42 +168,31 @@ void __init mem_init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __init void free_init_pages(const char *what, unsigned long begin, unsigned long end)
|
||||||
|
{
|
||||||
|
unsigned long addr;
|
||||||
|
/* next to check that the page we free is not a partial page */
|
||||||
|
for (addr = begin; addr + PAGE_SIZE <= end; addr += PAGE_SIZE) {
|
||||||
|
ClearPageReserved(virt_to_page(addr));
|
||||||
|
init_page_count(virt_to_page(addr));
|
||||||
|
free_page(addr);
|
||||||
|
totalram_pages++;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_BLK_DEV_INITRD
|
#ifdef CONFIG_BLK_DEV_INITRD
|
||||||
void __init free_initrd_mem(unsigned long start, unsigned long end)
|
void __init free_initrd_mem(unsigned long start, unsigned long end)
|
||||||
{
|
{
|
||||||
int pages = 0;
|
free_init_pages("initrd memory", start, end);
|
||||||
for (; start < end; start += PAGE_SIZE) {
|
|
||||||
ClearPageReserved(virt_to_page(start));
|
|
||||||
init_page_count(virt_to_page(start));
|
|
||||||
free_page(start);
|
|
||||||
totalram_pages++;
|
|
||||||
pages++;
|
|
||||||
}
|
|
||||||
printk(KERN_NOTICE "Freeing initrd memory: %dk freed\n", pages);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void __init free_initmem(void)
|
void __init free_initmem(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_RAMKERNEL
|
#ifdef CONFIG_RAMKERNEL
|
||||||
unsigned long addr;
|
free_init_pages("unused kernel memory",
|
||||||
/*
|
(unsigned long)(&__init_begin),
|
||||||
* the following code should be cool even if these sections
|
(unsigned long)(&__init_end));
|
||||||
* are not page aligned.
|
|
||||||
*/
|
|
||||||
addr = PAGE_ALIGN((unsigned long)(__init_begin));
|
|
||||||
/* next to check that the page we free is not a partial page */
|
|
||||||
for (; addr + PAGE_SIZE < (unsigned long)(__init_end);
|
|
||||||
addr += PAGE_SIZE) {
|
|
||||||
ClearPageReserved(virt_to_page(addr));
|
|
||||||
init_page_count(virt_to_page(addr));
|
|
||||||
free_page(addr);
|
|
||||||
totalram_pages++;
|
|
||||||
}
|
|
||||||
printk(KERN_NOTICE
|
|
||||||
"Freeing unused kernel memory: %ldk freed (0x%x - 0x%x)\n",
|
|
||||||
(addr - PAGE_ALIGN((long)__init_begin)) >> 10,
|
|
||||||
(int)(PAGE_ALIGN((unsigned long)(__init_begin))),
|
|
||||||
(int)(addr - PAGE_SIZE));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user