x86: implement true end_pfn_mapped for 32bit
authorAndi Kleen <andi@firstfloor.org>
Wed, 12 Mar 2008 02:53:27 +0000 (03:53 +0100)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Apr 2008 15:41:30 +0000 (17:41 +0200)
Even on 32bit 2MB pages can map more memory than is in the true
max_low_pfn if end_pfn is not highmem and not aligned to 2MB.
Add a end_pfn_map similar to x86-64 that accounts for this
fact. This is important for code that really needs to know about
all mapping aliases.

Signed-off-by: Andi Kleen <ak@suse.de>
Cc: andreas.herrmann3@amd.com
Cc: mingo@elte.hu
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/init_32.c
include/asm-x86/page.h
include/asm-x86/page_64.h

index 00168e65688a47461cf382a0503c8aefb74cda83..73dd0601166a0d7b94475c677f9318342414cb05 100644 (file)
@@ -51,6 +51,8 @@
 
 unsigned int __VMALLOC_RESERVE = 128 << 20;
 
+unsigned long end_pfn_map;
+
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 unsigned long highstart_pfn, highend_pfn;
 
@@ -194,6 +196,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
                                set_pmd(pmd, pfn_pmd(pfn, prot));
 
                                pfn += PTRS_PER_PTE;
+                               end_pfn_map = pfn;
                                continue;
                        }
                        pte = one_page_table_init(pmd);
@@ -208,6 +211,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
 
                                set_pte(pte, pfn_pte(pfn, prot));
                        }
+                       end_pfn_map = pfn;
                }
        }
 }
index a05b2896492f4c0feec091924d7b00a69128d81a..b734939916c441c8597a64abfcdfe4fa217c2488 100644 (file)
@@ -36,7 +36,7 @@
 #define max_pfn_mapped         end_pfn_map
 #else
 #include <asm/page_32.h>
-#define max_pfn_mapped         max_low_pfn
+#define max_pfn_mapped         end_pfn_map
 #endif /* CONFIG_X86_64 */
 
 #define PAGE_OFFSET            ((unsigned long)__PAGE_OFFSET)
@@ -50,6 +50,8 @@
 
 extern int page_is_ram(unsigned long pagenr);
 
+extern unsigned long end_pfn_map;
+
 struct page;
 
 static inline void clear_user_page(void *page, unsigned long vaddr,
index f156778f707c431298ea5a91a0261ea4ca7da535..54d5db634858e8bff53dd79abde113b14ebbfbad 100644 (file)
@@ -59,7 +59,6 @@ void clear_page(void *page);
 void copy_page(void *to, void *from);
 
 extern unsigned long end_pfn;
-extern unsigned long end_pfn_map;
 extern unsigned long phys_base;
 
 extern unsigned long __phys_addr(unsigned long);