Skip to content

Commit

Permalink
x86: also use debug_pagealloc_enabled() for free_init_pages
Browse files Browse the repository at this point in the history
we want to couple all debugging features with debug_pagealloc_enabled()
and not with the config option CONFIG_DEBUG_PAGEALLOC.

Signed-off-by: Christian Borntraeger <[email protected]>
Suggested-by: David Rientjes <[email protected]>
Acked-by: David Rientjes <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
Cc: Laura Abbott <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Heiko Carstens <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
borntraeger authored and torvalds committed Mar 15, 2016
1 parent 10917b8 commit a75e1f6
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions arch/x86/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,21 +667,22 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
* mark them not present - any buggy init-section access will
* create a kernel page fault:
*/
#ifdef CONFIG_DEBUG_PAGEALLOC
printk(KERN_INFO "debug: unmapping init [mem %#010lx-%#010lx]\n",
begin, end - 1);
set_memory_np(begin, (end - begin) >> PAGE_SHIFT);
#else
/*
* We just marked the kernel text read only above, now that
* we are going to free part of that, we need to make that
* writeable and non-executable first.
*/
set_memory_nx(begin, (end - begin) >> PAGE_SHIFT);
set_memory_rw(begin, (end - begin) >> PAGE_SHIFT);
if (debug_pagealloc_enabled()) {
pr_info("debug: unmapping init [mem %#010lx-%#010lx]\n",
begin, end - 1);
set_memory_np(begin, (end - begin) >> PAGE_SHIFT);
} else {
/*
* We just marked the kernel text read only above, now that
* we are going to free part of that, we need to make that
* writeable and non-executable first.
*/
set_memory_nx(begin, (end - begin) >> PAGE_SHIFT);
set_memory_rw(begin, (end - begin) >> PAGE_SHIFT);

free_reserved_area((void *)begin, (void *)end, POISON_FREE_INITMEM, what);
#endif
free_reserved_area((void *)begin, (void *)end,
POISON_FREE_INITMEM, what);
}
}

void free_initmem(void)
Expand Down

0 comments on commit a75e1f6

Please sign in to comment.