sched: don't wait in kthread_bind for presmp initcalls
PATCH 1/1 sched: don't wait in kthread_bind for presmp initcalls
From: Abbas Raza <[email protected]>
wait_task_inactive shouldn't be called in kthread_bind for presmp initcalls the same way it is done in !SMP case.
more info here:
http://permalink.gmane.org/gmane.linux.kernel.embedded/4046
This patch improves boot time for pre-smp initcalls as given below
initcall spawn_ksoftirqd+0x0/0x54 returned 0 after 0 usecs initcall init_workqueues+0x0/0x358 returned 0 after 0 usecs initcall cpu_stop_init+0x0/0xcc returned 0 after 0 usecs
boot time without this patch:
initcall spawn_ksoftirqd+0x0/0x54 returned 0 after 9765 usecs initcall init_workqueues+0x0/0x358 returned 0 after 9765 usecs initcall cpu_stop_init+0x0/0xcc returned 0 after 19531 usecs
--- kernel/kthread.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/kthread.c +9 -4
@@ -221,10 +221,15 @@ EXPORT_SYMBOL(kthread_create_on_node);*/ void kthread_bind (struct task_struct *p,unsigned int cpu) { -/* Must have done schedule() in kthread() before we set_task_cpu */ -if (!wait_task_inactive (p,TASK_UNINTERRUPTIBLE )) { -WARN_ON (1 ); -return ; +if (!((num_online_cpus () ==1 ) && !cpu)) { +/* +* Must have done schedule() in kthread() before +* we set_task_cpu +*/ +if (!wait_task_inactive (p,TASK_UNINTERRUPTIBLE )) { +WARN_ON (1 ); +return ; + } }/* It's safe because the task is inactive. */
Signature · 1 line
1.8.3.2
Quoted 33 lines · Abbas Raza
From: Abbas Raza <[email protected]>
wait_task_inactiveshouldn't be called inkthread_bindfor presmp initcalls the same way it is done in !SMP case.more info here:
http://permalink.gmane.org/gmane.linux.kernel.embedded/4046This patch improves boot time for pre-smp initcalls as given below
initcall
spawn_ksoftirqd+0x0/0x54returned 0 after 0 usecs initcallinit_workqueues+0x0/0x358returned 0 after 0 usecs initcallcpu_stop_init+0x0/0xccreturned 0 after 0 usecsboot time without this patch:
initcall
spawn_ksoftirqd+0x0/0x54returned 0 after 9765 usecs initcallinit_workqueues+0x0/0x358returned 0 after 9765 usecs initcallcpu_stop_init+0x0/0xccreturned 0 after 19531 usecsSigned-off-by Abbas Raza <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>--- kernel/kthread.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)kernel/kthread.c +0
-0
kernel/kthread.c EXPORT_SYMBOL(kthread_create_on_node); · line 227
Quoted 7 lines
kernel/kthread.c +0
-4@@ -221,10 +221,15 @@ EXPORT_SYMBOL(kthread_create_on_node);*/ void kthread_bind (struct task_struct *p,unsigned int cpu) { -/* Must have done schedule() in kthread() before we set_task_cpu */ -if (!wait_task_inactive (p,TASK_UNINTERRUPTIBLE )) { -WARN_ON (1 ); -return ;
Hi Abbas, this patch isn't based the current mainline, and kthread_bind() has been changed since v3.9.
Quoted 13 lines
kernel/kthread.c +9
-0+if (!((num_online_cpus () ==1 ) && !cpu)) { +/* +* Must have done schedule() in kthread() before +* we set_task_cpu +*/ +if (!wait_task_inactive (p,TASK_UNINTERRUPTIBLE )) { +WARN_ON (1 ); +return ; + } }/* It's safe because the task is inactive. */