aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMax Krasnyansky <maxk@qualcomm.com>2008-07-15 23:56:26 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-18 07:23:18 -0400
commit39b0fad7121eace85770e7a4c6dc35dfd2879768 (patch)
treea5d85b06fd656ccb26c906c237fb45dccd46e18c /kernel
parente761b7725234276a802322549cee5255305a0930 (diff)
cpu hotplug: Make cpu_active_map synchronization dependency clear
This goes on top of the cpu_active_map (take 2) patch. Currently we depend on the stop_machine to provide nescessesary synchronization for the cpu_active_map updates. As Dmitry Adamushko pointed this is fragile and is not much clearer than the previous scheme. In other words we do not want to depend on the internal stop machine operation here. So make the synchronization rules clear by doing synchronize_sched() after clearing out cpu active bit. Tested on quad-Core2 with: while true; do for i in 1 2 3; do echo 0 > /sys/devices/system/cpu/cpu$i/online done for i in 1 2 3; do echo 1 > /sys/devices/system/cpu/cpu$i/online done done and stress -c 200 No lockdep, preempt or other complaints. Signed-off-by: Max Krasnyansky <maxk@qualcomm.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index a1ac7ea245d7..033603c1d7c3 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -301,6 +301,16 @@ int __ref cpu_down(unsigned int cpu)
301 301
302 cpu_clear(cpu, cpu_active_map); 302 cpu_clear(cpu, cpu_active_map);
303 303
304 /*
305 * Make sure the all cpus did the reschedule and are not
306 * using stale version of the cpu_active_map.
307 * This is not strictly necessary becuase stop_machine()
308 * that we run down the line already provides the required
309 * synchronization. But it's really a side effect and we do not
310 * want to depend on the innards of the stop_machine here.
311 */
312 synchronize_sched();
313
304 err = _cpu_down(cpu, 0); 314 err = _cpu_down(cpu, 0);
305 315
306 if (cpu_online(cpu)) 316 if (cpu_online(cpu))