login
Header Space

 
 

[PATCH CPA] [24/28] CPA: Only unmap kernel init pages in text mapping when CONFIG_DEBUG_RODATA is set

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <jbeulich@...>, <linux-kernel@...>
Date: Thursday, January 3, 2008 - 11:24 am

Otherwise the kernel will likely always run with 4K pages instead of 2MB pages,
which is costly in terms of TLBs.

Also optimize it a little bit by using only a single change_page_attr() calls.
This is particularly useful if debugging is enabled inside it because it spams
the logs much less.

Cc: jbeulich@novell.com

Signed-off-by: Andi Kleen <ak@suse.de>

---
 arch/x86/mm/init_64.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux/arch/x86/mm/init_64.c
===================================================================
--- linux.orig/arch/x86/mm/init_64.c
+++ linux/arch/x86/mm/init_64.c
@@ -546,13 +546,15 @@ void free_init_pages(char *what, unsigne
 		init_page_count(virt_to_page(addr));
 		memset((void *)(addr & ~(PAGE_SIZE-1)),
 			POISON_FREE_INITMEM, PAGE_SIZE);
-		if (addr >= __START_KERNEL_map)
-			change_page_attr_addr(addr, 1, __pgprot(0));
 		free_page(addr);
 		totalram_pages++;
 	}
-	if (addr > __START_KERNEL_map)
+#ifdef CONFIG_DEBUG_RODATA
+	if (begin >= __START_KERNEL_map) {
+		change_page_attr_addr(begin, (end - begin)/PAGE_SIZE, __pgprot(0));
 		global_flush_tlb();
+	}
+#endif
 }
 
 void free_initmem(void)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 5:31 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 5:53 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 6:43 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 7:07 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 8:22 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 8:39 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 6:04 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 6:07 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 6:57 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 7:12 am)
Re: CPA patchset, Ingo Molnar, (Fri Jan 11, 3:19 am)
Re: CPA patchset, dean gaudet, (Fri Jan 11, 1:02 pm)
Re: CPA patchset, dean gaudet, (Fri Jan 11, 1:56 pm)
Re: CPA patchset, Arjan van de Ven, (Fri Jan 11, 1:18 pm)
Re: CPA patchset, Andi Kleen, (Fri Jan 11, 7:26 am)
Re: CPA patchset, Ingo Molnar, (Fri Jan 11, 3:33 am)
Re: CPA patchset, Andi Kleen, (Fri Jan 11, 7:28 am)
Re: CPA patchset, Dave Airlie, (Thu Jan 10, 5:44 am)
Re: CPA patchset, Ingo Molnar, (Thu Jan 10, 6:02 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 5:55 am)
Re: CPA patchset, Dave Airlie, (Thu Jan 10, 6:20 am)
Re: CPA patchset, Andi Kleen, (Thu Jan 10, 6:50 am)
[PATCH CPA] [24/28] CPA: Only unmap kernel init pages in tex..., Andi Kleen, (Thu Jan 3, 11:24 am)
[PATCH CPA] [9/28] CPA: Add simple self test at boot, Andi Kleen, (Thu Jan 3, 11:24 am)
[PATCH CPA] [6/28] CPA: Undo white space changes, Andi Kleen, (Thu Jan 3, 11:24 am)
[PATCH CPA] [5/28] Add pte_pgprot on i386, Andi Kleen, (Thu Jan 3, 11:24 am)
[PATCH CPA] [4/28] Add pte_clrhuge on i386, Andi Kleen, (Thu Jan 3, 11:24 am)
Re: [PATCH CPA] [4/28] Add pte_clrhuge on i386, Jeremy Fitzhardinge, (Sat Jan 5, 2:48 am)
speck-geostationary