aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/init_32.c11
-rw-r--r--arch/x86/mm/init_64.c11
2 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index a72737c0574..8d7f723cfc2 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -783,6 +783,16 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
783{ 783{
784 unsigned long addr; 784 unsigned long addr;
785 785
786#ifdef CONFIG_DEBUG_PAGEALLOC
787 /*
788 * If debugging page accesses then do not free this memory but
789 * mark them not present - any buggy init-section access will
790 * create a kernel page fault:
791 */
792 printk(KERN_INFO "debug: unmapping init memory %08lx..%08lx\n",
793 begin, PAGE_ALIGN(end));
794 set_memory_np(begin, (end - begin) >> PAGE_SHIFT);
795#else
786 /* 796 /*
787 * We just marked the kernel text read only above, now that 797 * We just marked the kernel text read only above, now that
788 * we are going to free part of that, we need to make that 798 * we are going to free part of that, we need to make that
@@ -798,6 +808,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
798 totalram_pages++; 808 totalram_pages++;
799 } 809 }
800 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); 810 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
811#endif
801} 812}
802 813
803void free_initmem(void) 814void free_initmem(void)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index f51180c02b8..e0c1e98ad1b 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -550,6 +550,16 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
550 if (begin >= end) 550 if (begin >= end)
551 return; 551 return;
552 552
553 /*
554 * If debugging page accesses then do not free this memory but
555 * mark them not present - any buggy init-section access will
556 * create a kernel page fault:
557 */
558#ifdef CONFIG_DEBUG_PAGEALLOC
559 printk(KERN_INFO "debug: unmapping init memory %08lx..%08lx\n",
560 begin, PAGE_ALIGN(end));
561 set_memory_np(begin, (end - begin) >> PAGE_SHIFT);
562#else
553 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10); 563 printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
554 for (addr = begin; addr < end; addr += PAGE_SIZE) { 564 for (addr = begin; addr < end; addr += PAGE_SIZE) {
555 ClearPageReserved(virt_to_page(addr)); 565 ClearPageReserved(virt_to_page(addr));
@@ -575,6 +585,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
575 set_memory_nx(begin, (end - begin)/PAGE_SIZE); 585 set_memory_nx(begin, (end - begin)/PAGE_SIZE);
576 } 586 }
577#endif 587#endif
588#endif
578} 589}
579 590
580void free_initmem(void) 591void free_initmem(void)