All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abbas Raza <abbas_raza@mentor.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@redhat.com, peterz@infradead.org, Xie XiuQi <xiexiuqi@huawei.com>
Subject: Re: [PATCH] kthread_bind: don't wait in kthread_bind for presmp initcalls
Date: Wed, 30 Oct 2013 21:00:28 +0500	[thread overview]
Message-ID: <52712D1C.9000802@mentor.com> (raw)
In-Reply-To: <1380300451-396-1-git-send-email-abbas_raza@mentor.com>

Hi,

Any thoughts here please?

Thanks .
Abbas Raza

On 09/27/2013 09:47 PM, Abbas Raza wrote:
> From: Abbas Raza <Abbas_Raza@mentor.com>
>
> 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
>
> boot time with this patch:
>
> calling  spawn_ksoftirqd+0x0/0x30 @ 1
> initcall spawn_ksoftirqd+0x0/0x30 returned 0 after 0 usecs
>
> boot time without this patch:
>
> calling  spawn_ksoftirqd+0x0/0x30 @ 1
> initcall spawn_ksoftirqd+0x0/0x30 returned 0 after 19531 usecs
>
> Signed-off-by: Abbas Raza <Abbas_Raza@mentor.com>
> ---
>  kernel/kthread.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 760e86d..28b5c4b 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -290,11 +290,17 @@ EXPORT_SYMBOL(kthread_create_on_node);
>  
>  static void __kthread_bind(struct task_struct *p, unsigned int cpu, long state)
>  {
> -	/* Must have done schedule() in kthread() before we set_task_cpu */
> -	if (!wait_task_inactive(p, state)) {
> -		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, state)) {
> +			WARN_ON(1);
> +			return;
> +		}
>  	}
> +
>  	/* It's safe because the task is inactive. */
>  	do_set_cpus_allowed(p, cpumask_of(cpu));
>  	p->flags |= PF_NO_SETAFFINITY;


      reply	other threads:[~2013-10-30 16:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-27 16:47 [PATCH] kthread_bind: don't wait in kthread_bind for presmp initcalls Abbas Raza
2013-10-30 16:00 ` Abbas Raza [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52712D1C.9000802@mentor.com \
    --to=abbas_raza@mentor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=xiexiuqi@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.