Commit 799e64f05f4bfaad2bb3165cab95c8c992a1c296
Committed by
Ingo Molnar
1 parent
27569620c7
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 12 additions and 5 deletions Side-by-side Diff
include/linux/cpu.h
... | ... | @@ -48,6 +48,15 @@ |
48 | 48 | |
49 | 49 | #ifdef CONFIG_SMP |
50 | 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 | 60 | #ifdef CONFIG_HOTPLUG_CPU |
52 | 61 | extern int register_cpu_notifier(struct notifier_block *nb); |
53 | 62 | extern void unregister_cpu_notifier(struct notifier_block *nb); |
... | ... | @@ -74,6 +83,8 @@ |
74 | 83 | |
75 | 84 | #else /* CONFIG_SMP */ |
76 | 85 | |
86 | +#define cpu_notifier(fn, pri) do { (void)(fn); } while (0) | |
87 | + | |
77 | 88 | static inline int register_cpu_notifier(struct notifier_block *nb) |
78 | 89 | { |
79 | 90 | return 0; |
... | ... | @@ -99,11 +110,7 @@ |
99 | 110 | |
100 | 111 | extern void get_online_cpus(void); |
101 | 112 | extern void put_online_cpus(void); |
102 | -#define hotcpu_notifier(fn, pri) { \ | |
103 | - static struct notifier_block fn##_nb __cpuinitdata = \ | |
104 | - { .notifier_call = fn, .priority = pri }; \ | |
105 | - register_cpu_notifier(&fn##_nb); \ | |
106 | -} | |
113 | +#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) | |
107 | 114 | #define register_hotcpu_notifier(nb) register_cpu_notifier(nb) |
108 | 115 | #define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) |
109 | 116 | int cpu_down(unsigned int cpu); |