diff options
Diffstat (limited to 'arch/i386/mm/init.c')
-rw-r--r-- | arch/i386/mm/init.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index 7ba55a6e2db..9f66ac582a8 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c | |||
@@ -720,21 +720,6 @@ static int noinline do_test_wp_bit(void) | |||
720 | return flag; | 720 | return flag; |
721 | } | 721 | } |
722 | 722 | ||
723 | void free_initmem(void) | ||
724 | { | ||
725 | unsigned long addr; | ||
726 | |||
727 | addr = (unsigned long)(&__init_begin); | ||
728 | for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { | ||
729 | ClearPageReserved(virt_to_page(addr)); | ||
730 | init_page_count(virt_to_page(addr)); | ||
731 | memset((void *)addr, 0xcc, PAGE_SIZE); | ||
732 | free_page(addr); | ||
733 | totalram_pages++; | ||
734 | } | ||
735 | printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (__init_end - __init_begin) >> 10); | ||
736 | } | ||
737 | |||
738 | #ifdef CONFIG_DEBUG_RODATA | 723 | #ifdef CONFIG_DEBUG_RODATA |
739 | 724 | ||
740 | extern char __start_rodata, __end_rodata; | 725 | extern char __start_rodata, __end_rodata; |
@@ -758,17 +743,31 @@ void mark_rodata_ro(void) | |||
758 | } | 743 | } |
759 | #endif | 744 | #endif |
760 | 745 | ||
746 | void free_init_pages(char *what, unsigned long begin, unsigned long end) | ||
747 | { | ||
748 | unsigned long addr; | ||
749 | |||
750 | for (addr = begin; addr < end; addr += PAGE_SIZE) { | ||
751 | ClearPageReserved(virt_to_page(addr)); | ||
752 | init_page_count(virt_to_page(addr)); | ||
753 | memset((void *)addr, 0xcc, PAGE_SIZE); | ||
754 | free_page(addr); | ||
755 | totalram_pages++; | ||
756 | } | ||
757 | printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10); | ||
758 | } | ||
759 | |||
760 | void free_initmem(void) | ||
761 | { | ||
762 | free_init_pages("unused kernel memory", | ||
763 | (unsigned long)(&__init_begin), | ||
764 | (unsigned long)(&__init_end)); | ||
765 | } | ||
761 | 766 | ||
762 | #ifdef CONFIG_BLK_DEV_INITRD | 767 | #ifdef CONFIG_BLK_DEV_INITRD |
763 | void free_initrd_mem(unsigned long start, unsigned long end) | 768 | void free_initrd_mem(unsigned long start, unsigned long end) |
764 | { | 769 | { |
765 | if (start < end) | 770 | free_init_pages("initrd memory", start, end); |
766 | printk (KERN_INFO "Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | ||
767 | for (; start < end; start += PAGE_SIZE) { | ||
768 | ClearPageReserved(virt_to_page(start)); | ||
769 | init_page_count(virt_to_page(start)); | ||
770 | free_page(start); | ||
771 | totalram_pages++; | ||
772 | } | ||
773 | } | 771 | } |
774 | #endif | 772 | #endif |
773 | |||