aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpu.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-07-28 13:16:28 -0400
committerRusty Russell <rusty@rustcorp.com.au>2008-07-27 22:16:29 -0400
commitffdb5976c47609c862917d4c186ecbb5706d2dda (patch)
tree7a8485260922290080094adc25f3cbebd4ad506b /kernel/cpu.c
parent5c2aed622571ac7c3c6ec182d6d3c318e4b45c8b (diff)
Simplify stop_machine
stop_machine creates a kthread which creates kernel threads. We can create those threads directly and simplify things a little. Some care must be taken with CPU hotunplug, which has special needs, but that code seems more robust than it was in the past. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r--kernel/cpu.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 10ba5f1004a5..cf79bb911371 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -216,7 +216,6 @@ static int __ref take_cpu_down(void *_param)
216static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) 216static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
217{ 217{
218 int err, nr_calls = 0; 218 int err, nr_calls = 0;
219 struct task_struct *p;
220 cpumask_t old_allowed, tmp; 219 cpumask_t old_allowed, tmp;
221 void *hcpu = (void *)(long)cpu; 220 void *hcpu = (void *)(long)cpu;
222 unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0; 221 unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
@@ -250,19 +249,15 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
250 cpu_clear(cpu, tmp); 249 cpu_clear(cpu, tmp);
251 set_cpus_allowed_ptr(current, &tmp); 250 set_cpus_allowed_ptr(current, &tmp);
252 251
253 p = __stop_machine_run(take_cpu_down, &tcd_param, cpu); 252 err = __stop_machine_run(take_cpu_down, &tcd_param, cpu);
254 253
255 if (IS_ERR(p) || cpu_online(cpu)) { 254 if (err || cpu_online(cpu)) {
256 /* CPU didn't die: tell everyone. Can't complain. */ 255 /* CPU didn't die: tell everyone. Can't complain. */
257 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod, 256 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
258 hcpu) == NOTIFY_BAD) 257 hcpu) == NOTIFY_BAD)
259 BUG(); 258 BUG();
260 259
261 if (IS_ERR(p)) { 260 goto out_allowed;
262 err = PTR_ERR(p);
263 goto out_allowed;
264 }
265 goto out_thread;
266 } 261 }
267 262
268 /* Wait for it to sleep (leaving idle task). */ 263 /* Wait for it to sleep (leaving idle task). */
@@ -279,8 +274,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
279 274
280 check_for_tasks(cpu); 275 check_for_tasks(cpu);
281 276
282out_thread:
283 err = kthread_stop(p);
284out_allowed: 277out_allowed:
285 set_cpus_allowed_ptr(current, &old_allowed); 278 set_cpus_allowed_ptr(current, &old_allowed);
286out_release: 279out_release: