Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1321735 > unrolled thread

[PATCH 1/1] x86: also use debug_pagealloc_enabled() for free_init_pages

Started byChristian Borntraeger <borntraeger@de.ibm.com>
First post2016-01-29 14:00 +0100
Last post2016-01-29 15:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/1] x86: also use debug_pagealloc_enabled() for free_init_pages Christian Borntraeger <borntraeger@de.ibm.com> - 2016-01-29 14:00 +0100
    Re: [PATCH 1/1] x86: also use debug_pagealloc_enabled() for  free_init_pages Thomas Gleixner <tglx@linutronix.de> - 2016-01-29 15:10 +0100

#1321735 — [PATCH 1/1] x86: also use debug_pagealloc_enabled() for free_init_pages

FromChristian Borntraeger <borntraeger@de.ibm.com>
Date2016-01-29 14:00 +0100
Subject[PATCH 1/1] x86: also use debug_pagealloc_enabled() for free_init_pages
Message-ID<qWgOC-3ad-19@gated-at.bofh.it>
we want to couple all debugging features with debug_pagealloc_enabled()
and not with the config option CONFIG_DEBUG_PAGEALLOC.

Suggested-by: David Rientjes <rientjes@google.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/x86/mm/init.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 39823fd..9d56f27 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -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)
-- 
2.3.0

[toc] | [next] | [standalone]


#1321779 — Re: [PATCH 1/1] x86: also use debug_pagealloc_enabled() for free_init_pages

FromThomas Gleixner <tglx@linutronix.de>
Date2016-01-29 15:10 +0100
SubjectRe: [PATCH 1/1] x86: also use debug_pagealloc_enabled() for free_init_pages
Message-ID<qWhUq-4fz-83@gated-at.bofh.it>
In reply to#1321735
On Fri, 29 Jan 2016, Christian Borntraeger wrote:

> we want to couple all debugging features with debug_pagealloc_enabled()
> and not with the config option CONFIG_DEBUG_PAGEALLOC.
> 
> Suggested-by: David Rientjes <rientjes@google.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web