mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: vatsa@in.ibm.com
Cc: mingo@redhat.com, rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: Re: keventd_create_kthread
Date: Thu, 19 Feb 2004 02:10:18 -0800	[thread overview]
Message-ID: <20040219021018.408d9c55.akpm@osdl.org> (raw)
In-Reply-To: <20040219100549.GA27018@in.ibm.com>

Srivatsa Vaddagiri <vatsa@in.ibm.com> wrote:
>
> On Thu, Feb 19, 2004 at 08:12:19AM +0000, Andrew Morton wrote:
> > However, if that wake_up_process() comes too early we'll just flip the new
> > thread out of TASK_INTERUPTIBLE into TASK_RUNNING and the schedule() in
> > kthread() will fall straight through.  So perhaps we can simply remove the
> > wait_task_inactive()?
> 
> If wake_up_process() comes too early (when the target task is still
> in TASK_RUNNING state), then won't wake_up_process() be a no-op?
> In which case, the target kthread will miss a wake-up event 
> (kthread_start/kthread_stop)?

No, that's OK - the new kernel thread sets TASK_INTERRUPTIBLE before waking
the invoking thread via complete():

new thread:

	/* OK, tell user we're spawned, wait for stop or wakeup */
	__set_current_state(TASK_INTERRUPTIBLE);
	complete(&create->started);
	schedule();

invoker:

	wait_for_completion(&create->started);
	create->result = find_task_by_pid(pid);
	wait_task_inactive(create->result);

It's the window after the complete() and before the schedule() where
wait_task_inactive() is spinning.


  reply	other threads:[~2004-02-19 10:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040218004648.7471bb37.akpm@osdl.org>
2004-02-18 23:12 ` keventd_create_kthread Rusty Russell
2004-02-19  7:46   ` keventd_create_kthread Ingo Molnar
2004-02-19  8:10     ` keventd_create_kthread Andrew Morton
2004-02-19  8:16       ` keventd_create_kthread Ingo Molnar
2004-02-19 10:05       ` keventd_create_kthread Srivatsa Vaddagiri
2004-02-19 10:10         ` Andrew Morton [this message]
2004-02-19  9:46     ` keventd_create_kthread Rusty Russell

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=20040219021018.408d9c55.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=vatsa@in.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®