Hello. On 12-02-2011 6:22, maksim.rayskiy@xxxxxxxxx wrote:
From: Maksim Rayskiy <mrayskiy@xxxxxxxxxxxx>
To avoid forking usertask when creating an idle task, move fork_idle to a work queue. This is a small improvement to previous commit 467f0b8.
Linus akss to also specify the commit summary in parens.
Signed-off-by: Maksim Rayskiy <mrayskiy@xxxxxxxxxxxx>
[...]
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 4593916..98bd504 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c @@ -193,6 +193,21 @@ void __devinit smp_prepare_boot_cpu(void) */ static struct task_struct *cpu_idle_thread[NR_CPUS]; +struct create_idle { + struct work_struct work; + struct task_struct *idle; + struct completion done; + int cpu; +}; + +static void __cpuinit do_fork_idle(struct work_struct *work) +{ + struct create_idle *c_idle = + container_of(work, struct create_idle, work);
Empty line wouldn't hurt here...
+ c_idle->idle = fork_idle(c_idle->cpu); + complete(&c_idle->done); +} + int __cpuinit __cpu_up(unsigned int cpu) { struct task_struct *idle; @@ -203,16 +218,21 @@ int __cpuinit __cpu_up(unsigned int cpu) * Linux can schedule processes on this slave. */ if (!cpu_idle_thread[cpu]) { - idle = fork_idle(cpu); - cpu_idle_thread[cpu] = idle; + /* Schedule work item to avoid forking user task. + Ported from x86 */
The preferred style of multi-line comments is this: /* * bla * bla */ WBR, Sergei