aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-04-20 09:05:49 -0400
committerThomas Gleixner <tglx@linutronix.de>2012-04-26 06:06:10 -0400
commit13583bf15eb1e890e03d46b6f2753e4b64af21c9 (patch)
treeff1121595142dbde3cb516661695859ba349f86c /arch/ia64/kernel
parent17e32eacc3543c25a4377bb7ce54026e38db7d20 (diff)
ia64: Use generic idle thread allocation
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/20120420124557.380965133@linutronix.de
Diffstat (limited to 'arch/ia64/kernel')
-rw-r--r--arch/ia64/kernel/smpboot.c61
1 files changed, 3 insertions, 58 deletions
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 03e4ef3893c9..1113b8aba07f 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -75,13 +75,6 @@
75#endif 75#endif
76 76
77/* 77/*
78 * Store all idle threads, this can be reused instead of creating
79 * a new thread. Also avoids complicated thread destroy functionality
80 * for idle threads.
81 */
82struct task_struct *idle_thread_array[NR_CPUS];
83
84/*
85 * Global array allocated for NR_CPUS at boot time 78 * Global array allocated for NR_CPUS at boot time
86 */ 79 */
87struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; 80struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS];
@@ -94,13 +87,7 @@ struct sal_to_os_boot *sal_state_for_booting_cpu = &sal_boot_rendez_state[0];
94 87
95#define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); 88#define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]);
96 89
97#define get_idle_for_cpu(x) (idle_thread_array[(x)])
98#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p))
99
100#else 90#else
101
102#define get_idle_for_cpu(x) (NULL)
103#define set_idle_for_cpu(x,p)
104#define set_brendez_area(x) 91#define set_brendez_area(x)
105#endif 92#endif
106 93
@@ -480,54 +467,12 @@ struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
480 return NULL; 467 return NULL;
481} 468}
482 469
483struct create_idle {
484 struct work_struct work;
485 struct task_struct *idle;
486 struct completion done;
487 int cpu;
488};
489
490void __cpuinit
491do_fork_idle(struct work_struct *work)
492{
493 struct create_idle *c_idle =
494 container_of(work, struct create_idle, work);
495
496 c_idle->idle = fork_idle(c_idle->cpu);
497 complete(&c_idle->done);
498}
499
500static int __cpuinit 470static int __cpuinit
501do_boot_cpu (int sapicid, int cpu) 471do_boot_cpu (int sapicid, int cpu, struct task_struct *idle)
502{ 472{
503 int timeout; 473 int timeout;
504 struct create_idle c_idle = {
505 .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle),
506 .cpu = cpu,
507 .done = COMPLETION_INITIALIZER(c_idle.done),
508 };
509
510 /*
511 * We can't use kernel_thread since we must avoid to
512 * reschedule the child.
513 */
514 c_idle.idle = get_idle_for_cpu(cpu);
515 if (c_idle.idle) {
516 init_idle(c_idle.idle, cpu);
517 goto do_rest;
518 }
519
520 schedule_work(&c_idle.work);
521 wait_for_completion(&c_idle.done);
522
523 if (IS_ERR(c_idle.idle))
524 panic("failed fork for CPU %d", cpu);
525
526 set_idle_for_cpu(cpu, c_idle.idle);
527
528do_rest:
529 task_for_booting_cpu = c_idle.idle;
530 474
475 task_for_booting_cpu = idle;
531 Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); 476 Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);
532 477
533 set_brendez_area(cpu); 478 set_brendez_area(cpu);
@@ -811,7 +756,7 @@ __cpu_up(unsigned int cpu, struct task_struct *tidle)
811 756
812 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 757 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
813 /* Processor goes to start_secondary(), sets online flag */ 758 /* Processor goes to start_secondary(), sets online flag */
814 ret = do_boot_cpu(sapicid, cpu); 759 ret = do_boot_cpu(sapicid, cpu, tidle);
815 if (ret < 0) 760 if (ret < 0)
816 return ret; 761 return ret;
817 762