mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Davide Libenzi <davidel@xmailserver.org>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Roland McGrath <roland@redhat.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] fix kthread_create() vs freezer theoretical race
Date: Fri, 13 Apr 2007 17:13:50 -0600	[thread overview]
Message-ID: <m1d527ook1.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20070413130119.GA164@tv-sign.ru> (Oleg Nesterov's message of "Fri, 13 Apr 2007 17:01:19 +0400")

Oleg Nesterov <oleg@tv-sign.ru> writes:

> kthread() sleeps in TASK_INTERRUPTIBLE state waiting for the first wakeup.
> In theory, this wakeup may come from freeze_process()->signal_wake_up(),
> so the task can disappear even before kthread_create() sets its ->comm.
>
> Change kthread() to use TASK_UNINTERRUPTIBLE.

Yep.  That makes sense.

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

>
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
>
> --- 2.6.21-rc5/kernel/kthread.c~0_FREEZER 2007-04-13 14:52:44.000000000 +0400
> +++ 2.6.21-rc5/kernel/kthread.c	2007-04-13 15:36:43.000000000 +0400
> @@ -70,7 +70,7 @@ static int kthread(void *_create)
>  	data = create->data;
>  
>  	/* OK, tell user we're spawned, wait for stop or wakeup */
> -	__set_current_state(TASK_INTERRUPTIBLE);
> +	__set_current_state(TASK_UNINTERRUPTIBLE);
>  	complete(&create->started);
>  	schedule();
>  
> @@ -174,7 +174,7 @@ EXPORT_SYMBOL(kthread_create);
>   */
>  void kthread_bind(struct task_struct *k, unsigned int cpu)
>  {
> -	BUG_ON(k->state != TASK_INTERRUPTIBLE);
> +	BUG_ON(k->state != TASK_UNINTERRUPTIBLE);
>  	/* Must have done schedule() in kthread() before we set_task_cpu */
>  	wait_task_inactive(k);
>  	set_task_cpu(k, cpu);

      reply	other threads:[~2007-04-13 23:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-13 13:01 Oleg Nesterov
2007-04-13 23:13 ` Eric W. Biederman [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=m1d527ook1.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=rjw@sisk.pl \
    --cc=roland@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome