Messages in this thread Patch in this message | | | Date | Wed, 7 Mar 2012 08:00:00 +0100 | From | Heiko Carstens <> | Subject | Re: [PATCH 5/5] s390: Use common fork_idle_from_wq in smpboot |
| |
On Tue, Mar 06, 2012 at 01:41:14PM -0800, Venkatesh Pallipadi wrote: > Cleanup. Instead of reimplementing fork_idle on wq and idle task caching, > use fork_idle_from_wq(). > > Signed-off-by: Venkatesh Pallipadi <venki@google.com> > --- > arch/s390/kernel/smp.c | 38 +++++--------------------------------- > 1 files changed, 5 insertions(+), 33 deletions(-)
Your patch won't apply on linux-next because of rather large code changes. Anyway see below a patch that applies cleanly (and works) on s390. Thanks for cleaning this up!
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
--- arch/s390/kernel/smp.c | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-)
--- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -83,7 +83,6 @@ enum { struct pcpu { struct cpu cpu; - struct task_struct *idle; /* idle process for the cpu */ struct _lowcore *lowcore; /* lowcore page(s) for the cpu */ unsigned long async_stack; /* async stack for the cpu */ unsigned long panic_stack; /* panic stack for the cpu */ @@ -724,26 +723,10 @@ static void __cpuinit smp_start_secondar cpu_idle(); } -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); -} - /* Upping and downing of CPUs */ int __cpuinit __cpu_up(unsigned int cpu) { - struct create_idle c_idle; + struct task_struct *idle; struct pcpu *pcpu; int rc; @@ -753,22 +736,14 @@ int __cpuinit __cpu_up(unsigned int cpu) if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) != sigp_order_code_accepted) return -EIO; - if (!pcpu->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); - pcpu->idle = c_idle.idle; - } - init_idle(pcpu->idle, cpu); + idle = fork_idle_from_wq(cpu); + if (IS_ERR(idle)) + return PTR_ERR(idle); rc = pcpu_alloc_lowcore(pcpu, cpu); if (rc) return rc; pcpu_prepare_secondary(pcpu, cpu); - pcpu_attach_task(pcpu, pcpu->idle); + pcpu_attach_task(pcpu, idle); pcpu_start_fn(pcpu, smp_start_secondary, NULL); while (!cpu_online(cpu)) cpu_relax(); @@ -855,7 +830,6 @@ void __init smp_prepare_boot_cpu(void) struct pcpu *pcpu = pcpu_devices; boot_cpu_address = stap(); - pcpu->idle = current; pcpu->state = CPU_STATE_CONFIGURED; pcpu->address = boot_cpu_address; pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix();
| |