Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

CRIS: Update init memory handling

- Add free_initrd_mem as found by Guenter Roeck <linux@roeck-us.net>
- Add free_init_pages
- Export empty_zero_page symbol

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>

+33 -5
+33 -5
arch/cris/mm/init.c
··· 11 11 #include <linux/gfp.h> 12 12 #include <linux/init.h> 13 13 #include <linux/bootmem.h> 14 + #include <linux/proc_fs.h> 15 + #include <linux/kcore.h> 14 16 #include <asm/tlb.h> 15 17 #include <asm/sections.h> 16 18 17 19 unsigned long empty_zero_page; 20 + EXPORT_SYMBOL(empty_zero_page); 18 21 19 - void __init 20 - mem_init(void) 22 + void __init mem_init(void) 21 23 { 22 24 BUG_ON(!mem_map); 23 25 ··· 33 31 mem_init_print_info(NULL); 34 32 } 35 33 36 - /* free the pages occupied by initialization code */ 34 + /* Free a range of init pages. Virtual addresses. */ 37 35 38 - void 39 - free_initmem(void) 36 + void free_init_pages(const char *what, unsigned long begin, unsigned long end) 37 + { 38 + unsigned long addr; 39 + 40 + for (addr = begin; addr < end; addr += PAGE_SIZE) { 41 + ClearPageReserved(virt_to_page(addr)); 42 + init_page_count(virt_to_page(addr)); 43 + free_page(addr); 44 + totalram_pages++; 45 + } 46 + 47 + printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10); 48 + } 49 + 50 + /* Free the pages occupied by initialization code. */ 51 + 52 + void free_initmem(void) 40 53 { 41 54 free_initmem_default(-1); 42 55 } 56 + 57 + /* Free the pages occupied by initrd code. */ 58 + 59 + #ifdef CONFIG_BLK_DEV_INITRD 60 + void free_initrd_mem(unsigned long start, unsigned long end) 61 + { 62 + free_init_pages("initrd memory", 63 + start, 64 + end); 65 + } 66 + #endif