[PATCH 5/5] s390: Use common fork_idle_from_wq in smpboot

From: Venkatesh Pallipadi
Date: Tue Mar 06 2012 - 16:42:14 EST


Cleanup. Instead of reimplementing fork_idle on wq and idle task caching,
use fork_idle_from_wq().

Signed-off-by: Venkatesh Pallipadi <venki@xxxxxxxxxx>
---
arch/s390/kernel/smp.c | 38 +++++---------------------------------
1 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 2398ce6..7255a57 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -58,8 +58,6 @@
/* logical cpu to cpu address */
unsigned short __cpu_logical_map[NR_CPUS];

-static struct task_struct *current_set[NR_CPUS];
-
static u8 smp_cpu_type;
static int smp_use_sigp_detection;

@@ -562,22 +560,6 @@ int __cpuinit start_secondary(void *cpuvoid)
return 0;
}

-struct create_idle {
- struct work_struct work;
- struct task_struct *idle;
- struct completion done;
- int cpu;
-};
-
-static void __cpuinit smp_fork_idle(struct work_struct *work)
-{
- struct create_idle *c_idle;
-
- c_idle = container_of(work, struct create_idle, work);
- c_idle->idle = fork_idle(c_idle->cpu);
- complete(&c_idle->done);
-}
-
static int __cpuinit smp_alloc_lowcore(int cpu)
{
unsigned long async_stack, panic_stack;
@@ -644,7 +626,6 @@ static void smp_free_lowcore(int cpu)
int __cpuinit __cpu_up(unsigned int cpu)
{
struct _lowcore *cpu_lowcore;
- struct create_idle c_idle;
struct task_struct *idle;
struct stack_frame *sf;
u32 lowcore;
@@ -652,19 +633,11 @@ int __cpuinit __cpu_up(unsigned int cpu)

if (smp_cpu_state[cpu] != CPU_STATE_CONFIGURED)
return -EIO;
- idle = current_set[cpu];
- if (!idle) {
- c_idle.done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done);
- INIT_WORK_ONSTACK(&c_idle.work, smp_fork_idle);
- c_idle.cpu = cpu;
- schedule_work(&c_idle.work);
- wait_for_completion(&c_idle.done);
- if (IS_ERR(c_idle.idle))
- return PTR_ERR(c_idle.idle);
- idle = c_idle.idle;
- current_set[cpu] = c_idle.idle;
- }
- init_idle(idle, cpu);
+
+ idle = fork_idle_from_wq(cpu);
+ if (IS_ERR(idle))
+ return PTR_ERR(idle);
+
if (smp_alloc_lowcore(cpu))
return -ENOMEM;
do {
@@ -836,7 +809,6 @@ void __init smp_prepare_boot_cpu(void)
set_cpu_present(0, true);
set_cpu_online(0, true);
S390_lowcore.percpu_offset = __per_cpu_offset[0];
- current_set[0] = current;
smp_cpu_state[0] = CPU_STATE_CONFIGURED;
cpu_set_polarization(0, POLARIZATION_UNKNOWN);
}
--
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/