slab: setup allocators earlier in the boot sequence
[safe/jmp/linux-2.6] / init / main.c
index bb7dc57..0ab82a4 100644 (file)
@@ -574,6 +574,28 @@ asmlinkage void __init start_kernel(void)
        setup_nr_cpu_ids();
        smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
 
+       build_all_zonelists();
+       page_alloc_init();
+
+       printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
+       parse_early_param();
+       parse_args("Booting kernel", static_command_line, __start___param,
+                  __stop___param - __start___param,
+                  &unknown_bootoption);
+       /*
+        * These use large bootmem allocations and must precede
+        * kmem_cache_init()
+        */
+       pidhash_init();
+       vmalloc_init();
+       vfs_caches_init_early();
+       sort_main_extable();
+       trap_init();
+       /*
+        * Set up kernel memory allocators
+        */
+       mem_init();
+       kmem_cache_init();
        /*
         * Set up the scheduler prior starting any interrupts (such as the
         * timer interrupt). Full topology setup happens at smp_init()
@@ -585,25 +607,15 @@ asmlinkage void __init start_kernel(void)
         * fragile until we cpu_idle() for the first time.
         */
        preempt_disable();
-       build_all_zonelists();
-       page_alloc_init();
-       printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
-       parse_early_param();
-       parse_args("Booting kernel", static_command_line, __start___param,
-                  __stop___param - __start___param,
-                  &unknown_bootoption);
        if (!irqs_disabled()) {
                printk(KERN_WARNING "start_kernel(): bug: interrupts were "
                                "enabled *very* early, fixing it\n");
                local_irq_disable();
        }
-       sort_main_extable();
-       trap_init();
        rcu_init();
        /* init some links before init_ISA_irqs() */
        early_irq_init();
        init_IRQ();
-       pidhash_init();
        init_timers();
        hrtimers_init();
        softirq_init();
@@ -645,14 +657,10 @@ asmlinkage void __init start_kernel(void)
                initrd_start = 0;
        }
 #endif
-       vmalloc_init();
-       vfs_caches_init_early();
        cpuset_init_early();
        page_cgroup_init();
-       mem_init();
        enable_debug_pagealloc();
        cpu_hotplug_init();
-       kmem_cache_init();
        kmemtrace_init();
        debug_objects_mem_init();
        idr_init_cache();