The patch titled i386: initialize end-of-memory variables as early as possible has been added to the -mm tree. Its filename is i386-initialize-end-of-memory-variables-as-early-as.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: i386: initialize end-of-memory variables as early as possible From: "Jan Beulich" <jbeulich@xxxxxxxxxx> 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@xxxxxxxxxx> Cc: Andi Kleen <ak@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/kernel/setup.c | 8 ++++++++ arch/i386/mm/discontig.c | 5 +++++ arch/i386/mm/highmem.c | 2 +- arch/i386/mm/init.c | 20 -------------------- 4 files changed, 14 insertions(+), 21 deletions(-) diff -puN arch/i386/kernel/setup.c~i386-initialize-end-of-memory-variables-as-early-as arch/i386/kernel/setup.c --- a/arch/i386/kernel/setup.c~i386-initialize-end-of-memory-variables-as-early-as +++ a/arch/i386/kernel/setup.c @@ -1169,6 +1169,14 @@ static unsigned long __init setup_memory } printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 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 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", pages_to_mb(max_low_pfn)); diff -puN arch/i386/mm/discontig.c~i386-initialize-end-of-memory-variables-as-early-as arch/i386/mm/discontig.c --- a/arch/i386/mm/discontig.c~i386-initialize-end-of-memory-variables-as-early-as +++ a/arch/i386/mm/discontig.c @@ -322,6 +322,11 @@ unsigned long __init setup_memory(void) highstart_pfn = system_max_low_pfn; printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 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 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", pages_to_mb(system_max_low_pfn)); diff -puN arch/i386/mm/highmem.c~i386-initialize-end-of-memory-variables-as-early-as arch/i386/mm/highmem.c --- a/arch/i386/mm/highmem.c~i386-initialize-end-of-memory-variables-as-early-as +++ a/arch/i386/mm/highmem.c @@ -54,7 +54,7 @@ void kunmap_atomic(void *kvaddr, enum km unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; 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(); preempt_check_resched(); return; diff -puN arch/i386/mm/init.c~i386-initialize-end-of-memory-variables-as-early-as arch/i386/mm/init.c --- a/arch/i386/mm/init.c~i386-initialize-end-of-memory-variables-as-early-as +++ a/arch/i386/mm/init.c @@ -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; void __init mem_init(void) @@ -590,14 +578,6 @@ void __init mem_init(void) } #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 */ totalram_pages += free_all_bootmem(); _ Patches currently in -mm which might be from jbeulich@xxxxxxxxxx are fix-trivial-unwind-info-bug.patch x86_64-unwinder-fix.patch i386-initialize-end-of-memory-variables-as-early-as.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html