x86-64: Move out cleanup higmap [_brk_end, _end) out of init_memory_mapping()
authorYinghai Lu <yinghai@kernel.org>
Tue, 28 Dec 2010 00:48:32 +0000 (16:48 -0800)
committerIngo Molnar <mingo@elte.hu>
Wed, 5 Jan 2011 13:03:45 +0000 (14:03 +0100)
It is not related to init_memory_mapping(),  and init_memory_mapping() is
getting more bigger.

So make it as seperated function and call it from reserve_brk() and that is
point when _brk_end is concluded.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <4D1933E0.7090305@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/kernel/setup.c
arch/x86/mm/init.c

index fc0fe743f3a1ffc311eee449a9557e38b74f5a2c..635185ba4435a6da992ca98d8a1be733a7558d49 100644 (file)
@@ -293,10 +293,32 @@ static void __init init_gbpages(void)
        else
                direct_gbpages = 0;
 }
+
+static void __init cleanup_highmap_brk_end(void)
+{
+       pud_t *pud;
+       pmd_t *pmd;
+
+       mmu_cr4_features = read_cr4();
+
+       /*
+        * _brk_end cannot change anymore, but it and _end may be
+        * located on different 2M pages. cleanup_highmap(), however,
+        * can only consider _end when it runs, so destroy any
+        * mappings beyond _brk_end here.
+        */
+       pud = pud_offset(pgd_offset_k(_brk_end), _brk_end);
+       pmd = pmd_offset(pud, _brk_end - 1);
+       while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1))
+               pmd_clear(pmd);
+}
 #else
 static inline void init_gbpages(void)
 {
 }
+static inline void cleanup_highmap_brk_end(void)
+{
+}
 #endif
 
 static void __init reserve_brk(void)
@@ -307,6 +329,8 @@ static void __init reserve_brk(void)
        /* Mark brk area as locked down and no longer taking any
           new allocations */
        _brk_start = 0;
+
+       cleanup_highmap_brk_end();
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
index fa6fe756d912067fda474a0e26d6b172aec423a3..35ee75d9061a928a0c38bf3b816173078815d6e6 100644 (file)
@@ -270,25 +270,6 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
        load_cr3(swapper_pg_dir);
 #endif
 
-#ifdef CONFIG_X86_64
-       if (!after_bootmem && !start) {
-               pud_t *pud;
-               pmd_t *pmd;
-
-               mmu_cr4_features = read_cr4();
-
-               /*
-                * _brk_end cannot change anymore, but it and _end may be
-                * located on different 2M pages. cleanup_highmap(), however,
-                * can only consider _end when it runs, so destroy any
-                * mappings beyond _brk_end here.
-                */
-               pud = pud_offset(pgd_offset_k(_brk_end), _brk_end);
-               pmd = pmd_offset(pud, _brk_end - 1);
-               while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1))
-                       pmd_clear(pmd);
-       }
-#endif
        __flush_tlb_all();
 
        if (!after_bootmem && e820_table_end > e820_table_start)