aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2009-06-10 12:40:04 -0400
committerPekka Enberg <penberg@cs.helsinki.fi>2009-06-11 12:15:56 -0400
commit83b519e8b9572c319c8e0c615ee5dd7272856090 (patch)
treeecf130629f6228d509bb52c533ca2287f966f972 /init
parentc91c4773b334d4d3a6d44626dc2a558ad97b86f3 (diff)
slab: setup allocators earlier in the boot sequence
This patch makes kmalloc() available earlier in the boot sequence so we can get rid of some bootmem allocations. The bulk of the changes are due to kmem_cache_init() being called with interrupts disabled which requires some changes to allocator boostrap code. Note: 32-bit x86 does WP protect test in mem_init() so we must setup traps before we call mem_init() during boot as reported by Ingo Molnar: We have a hard crash in the WP-protect code: [ 0.000000] Checking if this processor honours the WP bit even in supervisor mode...BUG: Int 14: CR2 ffcff000 [ 0.000000] EDI 00000188 ESI 00000ac7 EBP c17eaf9c ESP c17eaf8c [ 0.000000] EBX 000014e0 EDX 0000000e ECX 01856067 EAX 00000001 [ 0.000000] err 00000003 EIP c10135b1 CS 00000060 flg 00010002 [ 0.000000] Stack: c17eafa8 c17fd410 c16747bc c17eafc4 c17fd7e5 000011fd f8616000 c18237cc [ 0.000000] 00099800 c17bb000 c17eafec c17f1668 000001c5 c17f1322 c166e039 c1822bf0 [ 0.000000] c166e033 c153a014 c18237cc 00020800 c17eaff8 c17f106a 00020800 01ba5003 [ 0.000000] Pid: 0, comm: swapper Not tainted 2.6.30-tip-02161-g7a74539-dirty #52203 [ 0.000000] Call Trace: [ 0.000000] [<c15357c2>] ? printk+0x14/0x16 [ 0.000000] [<c10135b1>] ? do_test_wp_bit+0x19/0x23 [ 0.000000] [<c17fd410>] ? test_wp_bit+0x26/0x64 [ 0.000000] [<c17fd7e5>] ? mem_init+0x1ba/0x1d8 [ 0.000000] [<c17f1668>] ? start_kernel+0x164/0x2f7 [ 0.000000] [<c17f1322>] ? unknown_bootoption+0x0/0x19c [ 0.000000] [<c17f106a>] ? __init_begin+0x6a/0x6f Acked-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by Linus Torvalds <torvalds@linux-foundation.org> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Matt Mackall <mpm@selenic.com> Cc: Nick Piggin <npiggin@suse.de> Cc: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'init')
-rw-r--r--init/main.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/init/main.c b/init/main.c
index bb7dc57eee36..0ab82a453de5 100644
--- a/init/main.c
+++ b/init/main.c
@@ -574,6 +574,28 @@ asmlinkage void __init start_kernel(void)
574 setup_nr_cpu_ids(); 574 setup_nr_cpu_ids();
575 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ 575 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
576 576
577 build_all_zonelists();
578 page_alloc_init();
579
580 printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
581 parse_early_param();
582 parse_args("Booting kernel", static_command_line, __start___param,
583 __stop___param - __start___param,
584 &unknown_bootoption);
585 /*
586 * These use large bootmem allocations and must precede
587 * kmem_cache_init()
588 */
589 pidhash_init();
590 vmalloc_init();
591 vfs_caches_init_early();
592 sort_main_extable();
593 trap_init();
594 /*
595 * Set up kernel memory allocators
596 */
597 mem_init();
598 kmem_cache_init();
577 /* 599 /*
578 * Set up the scheduler prior starting any interrupts (such as the 600 * Set up the scheduler prior starting any interrupts (such as the
579 * timer interrupt). Full topology setup happens at smp_init() 601 * timer interrupt). Full topology setup happens at smp_init()
@@ -585,25 +607,15 @@ asmlinkage void __init start_kernel(void)
585 * fragile until we cpu_idle() for the first time. 607 * fragile until we cpu_idle() for the first time.
586 */ 608 */
587 preempt_disable(); 609 preempt_disable();
588 build_all_zonelists();
589 page_alloc_init();
590 printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
591 parse_early_param();
592 parse_args("Booting kernel", static_command_line, __start___param,
593 __stop___param - __start___param,
594 &unknown_bootoption);
595 if (!irqs_disabled()) { 610 if (!irqs_disabled()) {
596 printk(KERN_WARNING "start_kernel(): bug: interrupts were " 611 printk(KERN_WARNING "start_kernel(): bug: interrupts were "
597 "enabled *very* early, fixing it\n"); 612 "enabled *very* early, fixing it\n");
598 local_irq_disable(); 613 local_irq_disable();
599 } 614 }
600 sort_main_extable();
601 trap_init();
602 rcu_init(); 615 rcu_init();
603 /* init some links before init_ISA_irqs() */ 616 /* init some links before init_ISA_irqs() */
604 early_irq_init(); 617 early_irq_init();
605 init_IRQ(); 618 init_IRQ();
606 pidhash_init();
607 init_timers(); 619 init_timers();
608 hrtimers_init(); 620 hrtimers_init();
609 softirq_init(); 621 softirq_init();
@@ -645,14 +657,10 @@ asmlinkage void __init start_kernel(void)
645 initrd_start = 0; 657 initrd_start = 0;
646 } 658 }
647#endif 659#endif
648 vmalloc_init();
649 vfs_caches_init_early();
650 cpuset_init_early(); 660 cpuset_init_early();
651 page_cgroup_init(); 661 page_cgroup_init();
652 mem_init();
653 enable_debug_pagealloc(); 662 enable_debug_pagealloc();
654 cpu_hotplug_init(); 663 cpu_hotplug_init();
655 kmem_cache_init();
656 kmemtrace_init(); 664 kmemtrace_init();
657 debug_objects_mem_init(); 665 debug_objects_mem_init();
658 idr_init_cache(); 666 idr_init_cache();