diff options
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 2060c6e57027..0e6353cf147a 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/gfp.h> | 17 | #include <linux/gfp.h> |
18 | #include <linux/suspend.h> | 18 | #include <linux/suspend.h> |
19 | 19 | ||
20 | #include "smpboot.h" | ||
21 | |||
20 | #ifdef CONFIG_SMP | 22 | #ifdef CONFIG_SMP |
21 | /* Serializes the updates to cpu_online_mask, cpu_present_mask */ | 23 | /* Serializes the updates to cpu_online_mask, cpu_present_mask */ |
22 | static DEFINE_MUTEX(cpu_add_remove_lock); | 24 | static DEFINE_MUTEX(cpu_add_remove_lock); |
@@ -295,11 +297,19 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen) | |||
295 | int ret, nr_calls = 0; | 297 | int ret, nr_calls = 0; |
296 | void *hcpu = (void *)(long)cpu; | 298 | void *hcpu = (void *)(long)cpu; |
297 | unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0; | 299 | unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0; |
300 | struct task_struct *idle; | ||
298 | 301 | ||
299 | if (cpu_online(cpu) || !cpu_present(cpu)) | 302 | if (cpu_online(cpu) || !cpu_present(cpu)) |
300 | return -EINVAL; | 303 | return -EINVAL; |
301 | 304 | ||
302 | cpu_hotplug_begin(); | 305 | cpu_hotplug_begin(); |
306 | |||
307 | idle = idle_thread_get(cpu); | ||
308 | if (IS_ERR(idle)) { | ||
309 | ret = PTR_ERR(idle); | ||
310 | goto out; | ||
311 | } | ||
312 | |||
303 | ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls); | 313 | ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls); |
304 | if (ret) { | 314 | if (ret) { |
305 | nr_calls--; | 315 | nr_calls--; |
@@ -309,7 +319,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen) | |||
309 | } | 319 | } |
310 | 320 | ||
311 | /* Arch-specific enabling code. */ | 321 | /* Arch-specific enabling code. */ |
312 | ret = __cpu_up(cpu); | 322 | ret = __cpu_up(cpu, idle); |
313 | if (ret != 0) | 323 | if (ret != 0) |
314 | goto out_notify; | 324 | goto out_notify; |
315 | BUG_ON(!cpu_online(cpu)); | 325 | BUG_ON(!cpu_online(cpu)); |
@@ -320,6 +330,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen) | |||
320 | out_notify: | 330 | out_notify: |
321 | if (ret != 0) | 331 | if (ret != 0) |
322 | __cpu_notify(CPU_UP_CANCELED | mod, hcpu, nr_calls, NULL); | 332 | __cpu_notify(CPU_UP_CANCELED | mod, hcpu, nr_calls, NULL); |
333 | out: | ||
323 | cpu_hotplug_done(); | 334 | cpu_hotplug_done(); |
324 | 335 | ||
325 | return ret; | 336 | return ret; |