]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
mm/init: cpu_hotplug_init() must be initialized before SLAB
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 23 Jun 2009 04:18:12 +0000 (21:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 23 Jun 2009 04:18:12 +0000 (21:18 -0700)
SLAB uses get/put_online_cpus() which use a mutex which is itself only
initialized when cpu_hotplug_init() is called.  Currently we hang suring
boot in SLAB due to doing that too late.

Reported by James Bottomley and Sachin Sant (and possibly others).
Debugged by Benjamin Herrenschmidt.

This just removes the dynamic initialization of the data structures, and
replaces it with a static one, avoiding this dependency entirely, and
removing one unnecessary special initcall.

Tested-by: Sachin Sant <sachinp@in.ibm.com>
Tested-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Tested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/cpu.h
init/main.c
kernel/cpu.c

index 2643d848df9014df4776423028e223498f5a6d66..4d668e05d45810078783c10137f2738ca8ec27da 100644 (file)
@@ -69,7 +69,6 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
 
 int cpu_up(unsigned int cpu);
 void notify_cpu_starting(unsigned int cpu);
-extern void cpu_hotplug_init(void);
 extern void cpu_maps_update_begin(void);
 extern void cpu_maps_update_done(void);
 
@@ -84,10 +83,6 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
 {
 }
 
-static inline void cpu_hotplug_init(void)
-{
-}
-
 static inline void cpu_maps_update_begin(void)
 {
 }
index 09131ec090c197a33c17382544bc4ef9ac87277e..4870dfeb9ee57798abd057eb74a5ac11497ff097 100644 (file)
@@ -678,7 +678,6 @@ asmlinkage void __init start_kernel(void)
 #endif
        page_cgroup_init();
        enable_debug_pagealloc();
-       cpu_hotplug_init();
        kmemtrace_init();
        kmemleak_init();
        debug_objects_mem_init();
index 395b6974dc8d56ccb2d91ede756069fe9b10c975..8ce10043e4aca1d9d48ab9f127e6079c8634f9fd 100644 (file)
@@ -34,14 +34,11 @@ static struct {
         * an ongoing cpu hotplug operation.
         */
        int refcount;
-} cpu_hotplug;
-
-void __init cpu_hotplug_init(void)
-{
-       cpu_hotplug.active_writer = NULL;
-       mutex_init(&cpu_hotplug.lock);
-       cpu_hotplug.refcount = 0;
-}
+} cpu_hotplug = {
+       .active_writer = NULL,
+       .lock = __MUTEX_INITIALIZER(cpu_hotplug.lock),
+       .refcount = 0,
+};
 
 #ifdef CONFIG_HOTPLUG_CPU