mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Holt <holt@sgi.com>
To: "Richard B. Johnson" <root@chaos.analogic.com>
Cc: Dean Nelson <dcn@sgi.com>, Arjan van de Ven <arjanv@redhat.com>,
	linux-kernel@vger.kernel.org, rusty@rustcorp.com.au
Subject: Re: calling kthread_create() from interrupt thread
Date: Tue, 15 Jun 2004 14:01:14 -0500	[thread overview]
Message-ID: <20040615190114.GA6151@lnx-holt.americas.sgi.com> (raw)
In-Reply-To: <Pine.LNX.4.53.0406151412350.2353@chaos>

On Tue, Jun 15, 2004 at 02:15:34PM -0400, Richard B. Johnson wrote:
> On Tue, 15 Jun 2004, Dean Nelson wrote:
> 
> > On Tue, Jun 15, 2004 at 07:49:37PM +0200, Arjan van de Ven wrote:
> > > On Tue, 2004-06-15 at 19:42, Dean Nelson wrote:
> > > > I'm working on a driver that needs to create threads that can sleep/block
> > > > for an indefinite period of time.
> > > >
> > > >     . Can kthread_create() be called from an interrupt handler?
> > >
> > > no
> > >
> > > >
> > > >     . Is the cost of a kthread's creation/demise low enough so that one
> > > >       can, as often as needed, create a kthread that performs a simple
> > > >       function and exits?  Or is the cost too high for this?
> > >
> > > for that we have keventd in 2.4, work queues in 2.6
> >
> > As mentioned above, it is possible for this "simple" function to sleep/block
> > for an indefinite period of time. I was under the impression that one
> > couldn't block a work queue thread for an indefinite period of time. Am
> > I mistaken?
> >
> > Thanks,
> > Dean
> >
> 
> If you make a kernel thread, it can sleep forever if it wants, you
> can wake it up with wake_up_interruptible() from an interrupt after
> you have laid out the work you want it to do. That kernel thread
> has access to all your kernel data space, plus can spin-lock to
> prevent an interrupt from changing things in critical sections,
> etc.
> 
> It's the greatest thing since sliced bread.
> 

The problem Dean is trying to address is as follows:

We receive an interrupt.  The interrupt handler determines that some work
needs to be done.  Part of that work to be done may result in the process
needing to go to sleep waiting for a resource to become available.

Currently, the interrupt handler wakes a thread sleeping on a
wait_event_interruptible().  This wakeup is taking approx 35uSec.  Dean
is looking for a lower latency means of doing the wakeup.

Thanks,
Robin

  reply	other threads:[~2004-06-15 19:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-15 17:42 Dean Nelson
2004-06-15 17:49 ` Arjan van de Ven
2004-06-15 18:05   ` Dean Nelson
2004-06-15 18:14     ` Jesse Barnes
2004-06-15 22:14       ` Jeff Garzik
2004-06-15 18:15     ` Richard B. Johnson
2004-06-15 19:01       ` Robin Holt [this message]
2004-06-15 19:28         ` Roland Dreier
2004-06-15 19:30         ` Chris Wright
2004-06-15 23:40         ` Rusty Russell
2004-06-15 19:14   ` Dean Nelson
2004-06-15 19:27     ` Roland Dreier
2004-06-15 19:59     ` Chris Wright
     [not found] <27qex-5LX-17@gated-at.bofh.it>
     [not found] ` <27qoT-5Uy-15@gated-at.bofh.it>
     [not found]   ` <27qxQ-67a-27@gated-at.bofh.it>
2004-06-15 20:41     ` Andi Kleen

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=20040615190114.GA6151@lnx-holt.americas.sgi.com \
    --to=holt@sgi.com \
    --cc=arjanv@redhat.com \
    --cc=dcn@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    --cc=rusty@rustcorp.com.au \
    /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®