aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2009-10-14 17:46:55 -0400
committerH. Peter Anvin <hpa@zytor.com>2009-10-20 01:46:00 -0400
commitb9af7c0d44b8bb71e3af5e94688d076414aa8c87 (patch)
tree8f61c3cf73224a5c698da853b42b17579b824c0b
parentadc1938994f7f1112d335d998b5218b0aa680ad6 (diff)
x86-64: preserve large page mapping for 1st 2MB kernel txt with CONFIG_DEBUG_RODATA
In the first 2MB, kernel text is co-located with kernel static page tables setup by head_64.S. CONFIG_DEBUG_RODATA chops this 2MB large page mapping to small 4KB pages as we mark the kernel text as RO, leaving the static page tables as RW. With CONFIG_DEBUG_RODATA disabled, OLTP run on NHM-EP shows 1% improvement with 2% reduction in system time and 1% improvement in iowait idle time. To recover this, move the kernel static page tables to .data section, so that we don't have to break the first 2MB of kernel text to small pages with CONFIG_DEBUG_RODATA. Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> LKML-Reference: <20091014220254.063193621@sbs-t61.sc.intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--arch/x86/kernel/head_64.S3
-rw-r--r--arch/x86/mm/init_64.c6
2 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 780cd928fcd5..b55ee4ff509f 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -262,11 +262,11 @@ ENTRY(secondary_startup_64)
262 .quad x86_64_start_kernel 262 .quad x86_64_start_kernel
263 ENTRY(initial_gs) 263 ENTRY(initial_gs)
264 .quad INIT_PER_CPU_VAR(irq_stack_union) 264 .quad INIT_PER_CPU_VAR(irq_stack_union)
265 __FINITDATA
266 265
267 ENTRY(stack_start) 266 ENTRY(stack_start)
268 .quad init_thread_union+THREAD_SIZE-8 267 .quad init_thread_union+THREAD_SIZE-8
269 .word 0 268 .word 0
269 __FINITDATA
270 270
271bad_address: 271bad_address:
272 jmp bad_address 272 jmp bad_address
@@ -340,6 +340,7 @@ ENTRY(name)
340 i = i + 1 ; \ 340 i = i + 1 ; \
341 .endr 341 .endr
342 342
343 .data
343 /* 344 /*
344 * This default setting generates an ident mapping at address 0x100000 345 * This default setting generates an ident mapping at address 0x100000
345 * and a mapping for the kernel that precisely maps virtual address 346 * and a mapping for the kernel that precisely maps virtual address
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index c20d30b440de..7dafd4159ad6 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -699,7 +699,7 @@ static int kernel_set_to_readonly;
699 699
700void set_kernel_text_rw(void) 700void set_kernel_text_rw(void)
701{ 701{
702 unsigned long start = PFN_ALIGN(_stext); 702 unsigned long start = PFN_ALIGN(_text);
703 unsigned long end = PFN_ALIGN(__start_rodata); 703 unsigned long end = PFN_ALIGN(__start_rodata);
704 704
705 if (!kernel_set_to_readonly) 705 if (!kernel_set_to_readonly)
@@ -713,7 +713,7 @@ void set_kernel_text_rw(void)
713 713
714void set_kernel_text_ro(void) 714void set_kernel_text_ro(void)
715{ 715{
716 unsigned long start = PFN_ALIGN(_stext); 716 unsigned long start = PFN_ALIGN(_text);
717 unsigned long end = PFN_ALIGN(__start_rodata); 717 unsigned long end = PFN_ALIGN(__start_rodata);
718 718
719 if (!kernel_set_to_readonly) 719 if (!kernel_set_to_readonly)
@@ -727,7 +727,7 @@ void set_kernel_text_ro(void)
727 727
728void mark_rodata_ro(void) 728void mark_rodata_ro(void)
729{ 729{
730 unsigned long start = PFN_ALIGN(_stext), end = PFN_ALIGN(__end_rodata); 730 unsigned long start = PFN_ALIGN(_text), end = PFN_ALIGN(__end_rodata);
731 unsigned long rodata_start = 731 unsigned long rodata_start =
732 ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK; 732 ((unsigned long)__start_rodata + PAGE_SIZE - 1) & PAGE_MASK;
733 733