summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 33caf5e97701..a9e710eef0e2 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -28,18 +28,23 @@
28static DEFINE_MUTEX(cpu_add_remove_lock); 28static DEFINE_MUTEX(cpu_add_remove_lock);
29 29
30/* 30/*
31 * The following two API's must be used when attempting 31 * The following two APIs (cpu_maps_update_begin/done) must be used when
32 * to serialize the updates to cpu_online_mask, cpu_present_mask. 32 * attempting to serialize the updates to cpu_online_mask & cpu_present_mask.
33 * The APIs cpu_notifier_register_begin/done() must be used to protect CPU
34 * hotplug callback (un)registration performed using __register_cpu_notifier()
35 * or __unregister_cpu_notifier().
33 */ 36 */
34void cpu_maps_update_begin(void) 37void cpu_maps_update_begin(void)
35{ 38{
36 mutex_lock(&cpu_add_remove_lock); 39 mutex_lock(&cpu_add_remove_lock);
37} 40}
41EXPORT_SYMBOL(cpu_notifier_register_begin);
38 42
39void cpu_maps_update_done(void) 43void cpu_maps_update_done(void)
40{ 44{
41 mutex_unlock(&cpu_add_remove_lock); 45 mutex_unlock(&cpu_add_remove_lock);
42} 46}
47EXPORT_SYMBOL(cpu_notifier_register_done);
43 48
44static RAW_NOTIFIER_HEAD(cpu_chain); 49static RAW_NOTIFIER_HEAD(cpu_chain);
45 50
@@ -183,6 +188,11 @@ int __ref register_cpu_notifier(struct notifier_block *nb)
183 return ret; 188 return ret;
184} 189}
185 190
191int __ref __register_cpu_notifier(struct notifier_block *nb)
192{
193 return raw_notifier_chain_register(&cpu_chain, nb);
194}
195
186static int __cpu_notify(unsigned long val, void *v, int nr_to_call, 196static int __cpu_notify(unsigned long val, void *v, int nr_to_call,
187 int *nr_calls) 197 int *nr_calls)
188{ 198{
@@ -206,6 +216,7 @@ static void cpu_notify_nofail(unsigned long val, void *v)
206 BUG_ON(cpu_notify(val, v)); 216 BUG_ON(cpu_notify(val, v));
207} 217}
208EXPORT_SYMBOL(register_cpu_notifier); 218EXPORT_SYMBOL(register_cpu_notifier);
219EXPORT_SYMBOL(__register_cpu_notifier);
209 220
210void __ref unregister_cpu_notifier(struct notifier_block *nb) 221void __ref unregister_cpu_notifier(struct notifier_block *nb)
211{ 222{
@@ -215,6 +226,12 @@ void __ref unregister_cpu_notifier(struct notifier_block *nb)
215} 226}
216EXPORT_SYMBOL(unregister_cpu_notifier); 227EXPORT_SYMBOL(unregister_cpu_notifier);
217 228
229void __ref __unregister_cpu_notifier(struct notifier_block *nb)
230{
231 raw_notifier_chain_unregister(&cpu_chain, nb);
232}
233EXPORT_SYMBOL(__unregister_cpu_notifier);
234
218/** 235/**
219 * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU 236 * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU
220 * @cpu: a CPU id 237 * @cpu: a CPU id