aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-12-06 03:08:34 -0500
committerIngo Molnar <mingo@elte.hu>2011-12-06 03:23:53 -0500
commit855c743a27bb58a9a521bdc485ef5acfdb69badc (patch)
tree0b53ae9a389f64a6f4c10492786d45d0453c6c25 /arch/x86/mm
parent706d9a9c8b5758390036b9980a2b12d809599777 (diff)
x86/mm: Initialize high mem before free_all_bootmem()
Patch fixes a boot crash with pagealloc debugging enabled: Initializing HighMem for node 0 (000377fe:0003fff0) BUG: unable to handle kernel paging request at f6fefe80 IP: [<c1621ab5>] find_range_array+0x5e/0x69 [...] Call Trace: [<c1622064>] __get_free_all_memory_range+0x39/0xb4 [<c1620dd0>] add_highpages_with_active_regions+0x18/0x9b [<c1621a2e>] set_highmem_pages_init+0x70/0x90 [<c162122b>] mem_init+0x50/0x21b [<c16155bd>] start_kernel+0x1bf/0x31c [<c1615065>] i386_start_kernel+0x65/0x67 The crash happens when memblock wants to allocate big area for temporary "struct range" array and reuses pages from top of low memory, which were already passed to the buddy allocator. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Cc: linux-mm@kvack.org Cc: Mel Gorman <mgorman@suse.de> Link: http://lkml.kernel.org/r/20111206080833.GB3105@redhat.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/init_32.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 3bebaed5021c..a2fecb1611cc 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -744,6 +744,17 @@ void __init mem_init(void)
744#ifdef CONFIG_FLATMEM 744#ifdef CONFIG_FLATMEM
745 BUG_ON(!mem_map); 745 BUG_ON(!mem_map);
746#endif 746#endif
747 /*
748 * With CONFIG_DEBUG_PAGEALLOC initialization of highmem pages has to
749 * be done before free_all_bootmem(). Memblock use free low memory for
750 * temporary data (see find_range_array()) and for this purpose can use
751 * pages that was already passed to the buddy allocator, hence marked as
752 * not accessible in the page tables when compiled with
753 * CONFIG_DEBUG_PAGEALLOC. Otherwise order of initialization is not
754 * important here.
755 */
756 set_highmem_pages_init();
757
747 /* this will put all low memory onto the freelists */ 758 /* this will put all low memory onto the freelists */
748 totalram_pages += free_all_bootmem(); 759 totalram_pages += free_all_bootmem();
749 760
@@ -755,8 +766,6 @@ void __init mem_init(void)
755 if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp))) 766 if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
756 reservedpages++; 767 reservedpages++;
757 768
758 set_highmem_pages_init();
759
760 codesize = (unsigned long) &_etext - (unsigned long) &_text; 769 codesize = (unsigned long) &_etext - (unsigned long) &_text;
761 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 770 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
762 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 771 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;