The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: ebiederm@xmission.com (Eric W. Biederman)
Cc: Oleg Nesterov <oleg@tv-sign.ru>,
	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 2/3] make kthread_create() more scalable
Date: Fri, 13 Apr 2007 15:08:41 -0700	[thread overview]
Message-ID: <20070413150841.a978bf4d.akpm@linux-foundation.org> (raw)
In-Reply-To: <m1lkgwndsu.fsf@ebiederm.dsl.xmission.com>

On Fri, 13 Apr 2007 15:51:29 -0600
ebiederm@xmission.com (Eric W. Biederman) wrote:

> Andrew Morton <akpm@linux-foundation.org> writes:
> 
> > On Fri, 13 Apr 2007 17:02:01 +0400
> > Oleg Nesterov <oleg@tv-sign.ru> wrote:
> >
> >> If kernel_thread(kthread) succeeds, kthread() can not fail on its path to
> >> complete(&create->started) + schedule(). After that it can't be woken because
> >> nobody can see the new task yet. This means:
> >> 
> >> 	- we don't need tasklist_lock for find_task_by_pid().
> >> 
> >> 	- create_kthread() doesn't need to wait for create->started. Instead,
> >> 	  kthread_create() first waits for create->created to get the result of
> >> 	  kernel_thread(), then waits for create->started to synchronize with
> >> 	  kthread().
> >
> > Why don't we need tasklist_lock for find_task_by_pid()?  I'd have though that
> > we'd at least need rcu_read_lock(), and I'm not sure that the implicit
> > understanding of pid-management internals here is a great idea.
> 
> We need rcu_read_lock().  Or else something could permute the pid hash table
> and get us into trouble.
> 

OK, I fixed that up.

The next patch (make-kthread_stop-scalable) removes the find_task_by_pid()
anyway.

Our kthread creation performance will be pretty poor anyway, due to the
need to do two (or more?) context switches.  If we ever need
super-low-latency kernel thread creation (eg, on-demand threads for AIO)
then that code would need to go direct to kernel_thread(), I guess.


  reply	other threads:[~2007-04-13 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-13 13:02 [PATCH 2/3] make kthread_create() more scalable Oleg Nesterov
2007-04-13 21:31 ` Andrew Morton
2007-04-13 21:51   ` Eric W. Biederman
2007-04-13 22:08     ` Andrew Morton [this message]
2007-04-13 23:06       ` Eric W. Biederman
2007-04-13 23:34 ` Eric W. Biederman

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=20070413150841.a978bf4d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=ebiederm@xmission.com \
    --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