IA64: includecheck fix: ia64, pgtable.h
[safe/jmp/linux-2.6] / init / main.c
index 7917695..2c5ade7 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/smp_lock.h>
 #include <linux/initrd.h>
 #include <linux/bootmem.h>
+#include <linux/acpi.h>
 #include <linux/tty.h>
 #include <linux/gfp.h>
 #include <linux/percpu.h>
@@ -56,6 +57,7 @@
 #include <linux/debug_locks.h>
 #include <linux/debugobjects.h>
 #include <linux/lockdep.h>
+#include <linux/kmemleak.h>
 #include <linux/pid_namespace.h>
 #include <linux/device.h>
 #include <linux/kthread.h>
@@ -64,6 +66,7 @@
 #include <linux/idr.h>
 #include <linux/ftrace.h>
 #include <linux/async.h>
+#include <linux/kmemcheck.h>
 #include <linux/kmemtrace.h>
 #include <trace/boot.h>
 
@@ -86,11 +89,6 @@ extern void sbus_init(void);
 extern void prio_tree_init(void);
 extern void radix_tree_init(void);
 extern void free_initmem(void);
-#ifdef CONFIG_ACPI
-extern void acpi_early_init(void);
-#else
-static inline void acpi_early_init(void) { }
-#endif
 #ifndef CONFIG_DEBUG_RODATA
 static inline void mark_rodata_ro(void) { }
 #endif
@@ -538,8 +536,14 @@ void __init __weak thread_info_cache_init(void)
  */
 static void __init mm_init(void)
 {
+       /*
+        * page_cgroup requires countinous pages as memmap
+        * and it's bigger than MAX_ORDER unless SPARSEMEM.
+        */
+       page_cgroup_init_flatmem();
        mem_init();
        kmem_cache_init();
+       pgtable_cache_init();
        vmalloc_init();
 }
 
@@ -621,6 +625,7 @@ asmlinkage void __init start_kernel(void)
        /* init some links before init_ISA_irqs() */
        early_irq_init();
        init_IRQ();
+       prio_tree_init();
        init_timers();
        hrtimers_init();
        softirq_init();
@@ -634,6 +639,11 @@ asmlinkage void __init start_kernel(void)
        early_boot_irqs_on();
        local_irq_enable();
 
+       /* Interrupts are enabled now so all GFP allocations are safe. */
+       set_gfp_allowed_mask(__GFP_BITS_MASK);
+
+       kmem_cache_init_late();
+
        /*
         * HACK ALERT! This is early. We're enabling the console before
         * we've done PCI setups etc, and console_init() must be aware of
@@ -662,11 +672,10 @@ asmlinkage void __init start_kernel(void)
                initrd_start = 0;
        }
 #endif
-       cpuset_init_early();
        page_cgroup_init();
        enable_debug_pagealloc();
-       cpu_hotplug_init();
        kmemtrace_init();
+       kmemleak_init();
        debug_objects_mem_init();
        idr_init_cache();
        setup_per_cpu_pageset();
@@ -675,8 +684,6 @@ asmlinkage void __init start_kernel(void)
                late_time_init();
        calibrate_delay();
        pidmap_init();
-       pgtable_cache_init();
-       prio_tree_init();
        anon_vma_init();
 #ifdef CONFIG_X86
        if (efi_enabled)
@@ -712,6 +719,17 @@ asmlinkage void __init start_kernel(void)
        rest_init();
 }
 
+/* Call all constructor functions linked into the kernel. */
+static void __init do_ctors(void)
+{
+#ifdef CONFIG_CONSTRUCTORS
+       ctor_fn_t *call = (ctor_fn_t *) __ctors_start;
+
+       for (; call < (ctor_fn_t *) __ctors_end; call++)
+               (*call)();
+#endif
+}
+
 int initcall_debug;
 core_param(initcall_debug, initcall_debug, bool, 0644);
 
@@ -792,6 +810,7 @@ static void __init do_basic_setup(void)
        usermodehelper_init();
        driver_init();
        init_irq_proc();
+       do_ctors();
        do_initcalls();
 }
 
@@ -859,6 +878,11 @@ static noinline int init_post(void)
 static int __init kernel_init(void * unused)
 {
        lock_kernel();
+
+       /*
+        * init can allocate pages on any node
+        */
+       set_mems_allowed(node_possible_map);
        /*
         * init can run on any cpu.
         */