Commit ba9c231f authored by Jan Beulich's avatar Jan Beulich Committed by Andi Kleen

[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: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 3b94355c
...@@ -1170,6 +1170,14 @@ static unsigned long __init setup_memory(void) ...@@ -1170,6 +1170,14 @@ static unsigned long __init setup_memory(void)
} }
printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
pages_to_mb(highend_pfn - highstart_pfn)); pages_to_mb(highend_pfn - highstart_pfn));
num_physpages = highend_pfn;
high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
#else
num_physpages = max_low_pfn;
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
#endif
#ifdef CONFIG_FLATMEM
max_mapnr = num_physpages;
#endif #endif
printk(KERN_NOTICE "%ldMB LOWMEM available.\n", printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
pages_to_mb(max_low_pfn)); pages_to_mb(max_low_pfn));
......
...@@ -313,6 +313,11 @@ unsigned long __init setup_memory(void) ...@@ -313,6 +313,11 @@ unsigned long __init setup_memory(void)
highstart_pfn = system_max_low_pfn; highstart_pfn = system_max_low_pfn;
printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
pages_to_mb(highend_pfn - highstart_pfn)); pages_to_mb(highend_pfn - highstart_pfn));
num_physpages = highend_pfn;
high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
#else
num_physpages = system_max_low_pfn;
high_memory = (void *) __va(system_max_low_pfn * PAGE_SIZE - 1) + 1;
#endif #endif
printk(KERN_NOTICE "%ldMB LOWMEM available.\n", printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
pages_to_mb(system_max_low_pfn)); pages_to_mb(system_max_low_pfn));
......
...@@ -54,7 +54,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type) ...@@ -54,7 +54,7 @@ void kunmap_atomic(void *kvaddr, enum km_type type)
unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id(); enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
if (vaddr < FIXADDR_START) { // FIXME if (vaddr >= PAGE_OFFSET && vaddr < (unsigned long)high_memory) {
dec_preempt_count(); dec_preempt_count();
preempt_check_resched(); preempt_check_resched();
return; return;
......
...@@ -552,18 +552,6 @@ static void __init test_wp_bit(void) ...@@ -552,18 +552,6 @@ static void __init test_wp_bit(void)
} }
} }
static void __init set_max_mapnr_init(void)
{
#ifdef CONFIG_HIGHMEM
num_physpages = highend_pfn;
#else
num_physpages = max_low_pfn;
#endif
#ifdef CONFIG_FLATMEM
max_mapnr = num_physpages;
#endif
}
static struct kcore_list kcore_mem, kcore_vmalloc; static struct kcore_list kcore_mem, kcore_vmalloc;
void __init mem_init(void) void __init mem_init(void)
...@@ -590,14 +578,6 @@ void __init mem_init(void) ...@@ -590,14 +578,6 @@ void __init mem_init(void)
} }
#endif #endif
set_max_mapnr_init();
#ifdef CONFIG_HIGHMEM
high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
#else
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
#endif
/* this will put all low memory onto the freelists */ /* this will put all low memory onto the freelists */
totalram_pages += free_all_bootmem(); totalram_pages += free_all_bootmem();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment