aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init_32.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-30 07:34:09 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:09 -0500
commitee01f1122ceb02a2c9b7142c5dd17b49e59ba774 (patch)
tree82f4d23f6857e2cc8e623295d3b06ab70c05fa10 /arch/x86/mm/init_32.c
parent1a4872529e13265d05ffae75b8d09697540016d2 (diff)
x86: init memory debugging
debug incorrect/late access to init memory, by permanently unmapping the init memory ranges. Depends on CONFIG_DEBUG_PAGEALLOC=y. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/mm/init_32.c')
-rw-r--r--arch/x86/mm/init_32.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index a72737c05747..8d7f723cfc28 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)