diff options
author | Gautham R Shenoy <ego@in.ibm.com> | 2008-01-25 15:08:02 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-25 15:08:02 -0500 |
commit | 86ef5c9a8edd78e6bf92879f32329d89b2d55b5a (patch) | |
tree | 7bf46885326a6fdbb0c3596855408e9a5634dd3a /kernel/cpu.c | |
parent | d221938c049f4845da13c8593132595a6b9222a8 (diff) |
cpu-hotplug: replace lock_cpu_hotplug() with get_online_cpus()
Replace all lock_cpu_hotplug/unlock_cpu_hotplug from the kernel and use
get_online_cpus and put_online_cpus instead as it highlights the
refcount semantics in these operations.
The new API guarantees protection against the cpu-hotplug operation, but
it doesn't guarantee serialized access to any of the local data
structures. Hence the changes needs to be reviewed.
In case of pseries_add_processor/pseries_remove_processor, use
cpu_maps_update_begin()/cpu_maps_update_done() as we're modifying the
cpu_present_map there.
Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 656dc3fcbbae..b0c4152995f8 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -48,7 +48,7 @@ void __init cpu_hotplug_init(void) | |||
48 | 48 | ||
49 | #ifdef CONFIG_HOTPLUG_CPU | 49 | #ifdef CONFIG_HOTPLUG_CPU |
50 | 50 | ||
51 | void lock_cpu_hotplug(void) | 51 | void get_online_cpus(void) |
52 | { | 52 | { |
53 | might_sleep(); | 53 | might_sleep(); |
54 | if (cpu_hotplug.active_writer == current) | 54 | if (cpu_hotplug.active_writer == current) |
@@ -58,9 +58,9 @@ void lock_cpu_hotplug(void) | |||
58 | mutex_unlock(&cpu_hotplug.lock); | 58 | mutex_unlock(&cpu_hotplug.lock); |
59 | 59 | ||
60 | } | 60 | } |
61 | EXPORT_SYMBOL_GPL(lock_cpu_hotplug); | 61 | EXPORT_SYMBOL_GPL(get_online_cpus); |
62 | 62 | ||
63 | void unlock_cpu_hotplug(void) | 63 | void put_online_cpus(void) |
64 | { | 64 | { |
65 | if (cpu_hotplug.active_writer == current) | 65 | if (cpu_hotplug.active_writer == current) |
66 | return; | 66 | return; |
@@ -73,7 +73,7 @@ void unlock_cpu_hotplug(void) | |||
73 | mutex_unlock(&cpu_hotplug.lock); | 73 | mutex_unlock(&cpu_hotplug.lock); |
74 | 74 | ||
75 | } | 75 | } |
76 | EXPORT_SYMBOL_GPL(unlock_cpu_hotplug); | 76 | EXPORT_SYMBOL_GPL(put_online_cpus); |
77 | 77 | ||
78 | #endif /* CONFIG_HOTPLUG_CPU */ | 78 | #endif /* CONFIG_HOTPLUG_CPU */ |
79 | 79 | ||
@@ -110,7 +110,7 @@ void cpu_maps_update_done(void) | |||
110 | * non zero and goes to sleep again. | 110 | * non zero and goes to sleep again. |
111 | * | 111 | * |
112 | * However, this is very difficult to achieve in practice since | 112 | * However, this is very difficult to achieve in practice since |
113 | * lock_cpu_hotplug() not an api which is called all that often. | 113 | * get_online_cpus() not an api which is called all that often. |
114 | * | 114 | * |
115 | */ | 115 | */ |
116 | static void cpu_hotplug_begin(void) | 116 | static void cpu_hotplug_begin(void) |