diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-08-15 12:53:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-15 13:02:07 -0400 |
commit | 799e64f05f4bfaad2bb3165cab95c8c992a1c296 (patch) | |
tree | 58fdef195cc924179a034d7f4f69c8ddaf0b994f /include/linux/cpu.h | |
parent | 27569620c748ec13f801b4683b448a2ac2adaae4 (diff) |
cpu hotplug: Introduce cpu_notifier() to handle !HOTPLUG_CPU case
This patch introduces a new cpu_notifier() API that is similar
to hotcpu_notifier(), but which also notifies of CPUs coming
online during boot in the !HOTPLUG_CPU case.
Reported-by: Ingo Molnar <mingo@elte.hu>
Reported-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Tested-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: josht@linux.vnet.ibm.com
Cc: akpm@linux-foundation.org
Cc: mathieu.desnoyers@polymtl.ca
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: benh@kernel.crashing.org
LKML-Reference: <12503552312611-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/cpu.h')
-rw-r--r-- | include/linux/cpu.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 4d668e05d458..47536197ffdd 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -48,6 +48,15 @@ struct notifier_block; | |||
48 | 48 | ||
49 | #ifdef CONFIG_SMP | 49 | #ifdef CONFIG_SMP |
50 | /* Need to know about CPUs going up/down? */ | 50 | /* Need to know about CPUs going up/down? */ |
51 | #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) | ||
52 | #define cpu_notifier(fn, pri) { \ | ||
53 | static struct notifier_block fn##_nb __cpuinitdata = \ | ||
54 | { .notifier_call = fn, .priority = pri }; \ | ||
55 | register_cpu_notifier(&fn##_nb); \ | ||
56 | } | ||
57 | #else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ | ||
58 | #define cpu_notifier(fn, pri) do { (void)(fn); } while (0) | ||
59 | #endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ | ||
51 | #ifdef CONFIG_HOTPLUG_CPU | 60 | #ifdef CONFIG_HOTPLUG_CPU |
52 | extern int register_cpu_notifier(struct notifier_block *nb); | 61 | extern int register_cpu_notifier(struct notifier_block *nb); |
53 | extern void unregister_cpu_notifier(struct notifier_block *nb); | 62 | extern void unregister_cpu_notifier(struct notifier_block *nb); |
@@ -74,6 +83,8 @@ extern void cpu_maps_update_done(void); | |||
74 | 83 | ||
75 | #else /* CONFIG_SMP */ | 84 | #else /* CONFIG_SMP */ |
76 | 85 | ||
86 | #define cpu_notifier(fn, pri) do { (void)(fn); } while (0) | ||
87 | |||
77 | static inline int register_cpu_notifier(struct notifier_block *nb) | 88 | static inline int register_cpu_notifier(struct notifier_block *nb) |
78 | { | 89 | { |
79 | return 0; | 90 | return 0; |
@@ -99,11 +110,7 @@ extern struct sysdev_class cpu_sysdev_class; | |||
99 | 110 | ||
100 | extern void get_online_cpus(void); | 111 | extern void get_online_cpus(void); |
101 | extern void put_online_cpus(void); | 112 | extern void put_online_cpus(void); |
102 | #define hotcpu_notifier(fn, pri) { \ | 113 | #define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) |
103 | static struct notifier_block fn##_nb __cpuinitdata = \ | ||
104 | { .notifier_call = fn, .priority = pri }; \ | ||
105 | register_cpu_notifier(&fn##_nb); \ | ||
106 | } | ||
107 | #define register_hotcpu_notifier(nb) register_cpu_notifier(nb) | 114 | #define register_hotcpu_notifier(nb) register_cpu_notifier(nb) |
108 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) | 115 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) |
109 | int cpu_down(unsigned int cpu); | 116 | int cpu_down(unsigned int cpu); |