diff options
author | Jan Beulich <jbeulich@novell.com> | 2006-09-26 04:52:31 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-09-26 04:52:31 -0400 |
commit | ba9c231f7499ff6918c069c72ff5fd836c76b963 (patch) | |
tree | dac0a7d22adf1d00ecf37e9b21f2115cbd12eb24 | |
parent | 3b94355c47e2b025a7ececa0a14180e8fce6b0f1 (diff) |
[PATCH] i386: initialize end-of-memory variables as early as possible
Move initialization of all memory end variables to as early as
possible, so that dependent code doesn't need to check whether these
variables have already been set.
Change the range check in kunmap_atomic to actually make use of this
so that the no-mapping-estabished path (under CONFIG_DEBUG_HIGHMEM)
gets used only when the address is inside the lowmem area (and BUG()
otherwise).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andi Kleen <ak@suse.de>
-rw-r--r-- | arch/i386/kernel/setup.c | 8 | ||||
-rw-r--r-- | arch/i386/mm/discontig.c | 5 | ||||
-rw-r--r-- | arch/i386/mm/highmem.c | 2 | ||||
-rw-r--r-- | arch/i386/mm/init.c | 20 |
4 files changed, 14 insertions, 21 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index f1682206d304..71a540362b78 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -1170,6 +1170,14 @@ static unsigned long __init setup_memory(void) | |||
1170 | } | 1170 | } |
1171 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", | 1171 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", |
1172 | pages_to_mb(highend_pfn - highstart_pfn)); | 1172 | pages_to_mb(highend_pfn - highstart_pfn)); |
1173 | num_physpages = highend_pfn; | ||
1174 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | ||
1175 | #else | ||
1176 | num_physpages = max_low_pfn; | ||
1177 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; | ||
1178 | #endif | ||
1179 | #ifdef CONFIG_FLATMEM | ||
1180 | max_mapnr = num_physpages; | ||
1173 | #endif | 1181 | #endif |
1174 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", | 1182 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", |
1175 | pages_to_mb(max_low_pfn)); | 1183 | pages_to_mb(max_low_pfn)); |
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c index 7c392dc553b8..f0c10b3cd158 100644 --- a/arch/i386/mm/discontig.c +++ b/arch/i386/mm/discontig.c | |||
@@ -313,6 +313,11 @@ unsigned long __init setup_memory(void) | |||
313 | highstart_pfn = system_max_low_pfn; | 313 | highstart_pfn = system_max_low_pfn; |
314 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", | 314 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", |
315 | pages_to_mb(highend_pfn - highstart_pfn)); | 315 | pages_to_mb(highend_pfn - highstart_pfn)); |
316 | num_physpages = highend_pfn; | ||
317 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | ||
318 | #else | ||
319 | num_physpages = system_max_low_pfn; | ||
320 | high_memory = (void *) __va(system_max_low_pfn * PAGE_SIZE - 1) + 1; | ||
316 | #endif | 321 | #endif |
317 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", | 322 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", |
318 | pages_to_mb(system_max_low_pfn)); | 323 | pages_to_mb(system_max_low_pfn)); |
diff --git a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c index b6eb4dcb8777..ba44000b9069 100644 --- a/arch/i386/mm/highmem.c +++ b/arch/i386/mm/highmem.c | |||
@@ -54,7 +54,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type) | |||
54 | unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; | 54 | unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; |
55 | enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); | 55 | enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); |
56 | 56 | ||
57 | if (vaddr < FIXADDR_START) { // FIXME | 57 | if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) { |
58 | dec_preempt_count(); | 58 | dec_preempt_count(); |
59 | preempt_check_resched(); | 59 | preempt_check_resched(); |
60 | return; | 60 | return; |
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index 89e8486aac34..d0c2fdf6a4d7 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c | |||
@@ -552,18 +552,6 @@ static void __init test_wp_bit(void) | |||
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | static void __init set_max_mapnr_init(void) | ||
556 | { | ||
557 | #ifdef CONFIG_HIGHMEM | ||
558 | num_physpages = highend_pfn; | ||
559 | #else | ||
560 | num_physpages = max_low_pfn; | ||
561 | #endif | ||
562 | #ifdef CONFIG_FLATMEM | ||
563 | max_mapnr = num_physpages; | ||
564 | #endif | ||
565 | } | ||
566 | |||
567 | static struct kcore_list kcore_mem, kcore_vmalloc; | 555 | static struct kcore_list kcore_mem, kcore_vmalloc; |
568 | 556 | ||
569 | void __init mem_init(void) | 557 | void __init mem_init(void) |
@@ -590,14 +578,6 @@ void __init mem_init(void) | |||
590 | } | 578 | } |
591 | #endif | 579 | #endif |
592 | 580 | ||
593 | set_max_mapnr_init(); | ||
594 | |||
595 | #ifdef CONFIG_HIGHMEM | ||
596 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | ||
597 | #else | ||
598 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; | ||
599 | #endif | ||
600 | |||
601 | /* this will put all low memory onto the freelists */ | 581 | /* this will put all low memory onto the freelists */ |
602 | totalram_pages += free_all_bootmem(); | 582 | totalram_pages += free_all_bootmem(); |
603 | 583 | ||