kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: dhylands@gmail.com (Dave Hylands)
To: kernelnewbies@lists.kernelnewbies.org
Subject: why tasklet cant sleep
Date: Thu, 10 Nov 2011 13:06:05 -0800	[thread overview]
Message-ID: <CABi1daEw8_ifEtqgMABJQ7Unt2TFJFuYDmqGUQM+OvMM-M3sow@mail.gmail.com> (raw)
In-Reply-To: <CABECqUH_L4Y3=YuiFm78YfL0gr5hRFnAHMWcBi07ihf-pBRwHg@mail.gmail.com>

Hi santhosh,

On Thu, Nov 10, 2011 at 8:38 AM, santhosh kumars <karuna.linux@gmail.com> wrote:
> hi,
> can any one please explain why tasklets cant sleep.softirqs and
> tasklets processing aided by the a set of per processor
> kernel threads(ksoftirqd) so it means tasklets/softirqs run in process
> context. it means tasklet can sleep right?

Generally speaking, tasklets "borrow" the stack of whatever process
happened to be running.

Stepping back a bit, hardware interrupts come along and interrupt
whatever task happened to be running. When the hardware IRQ stack gets
back down to the task level again (i.e. all nested HW IRQs are
processed, then it enabled interrupts and starts any queued tasklets.
So tasklets are really still "interrupt" context, but with interrupts
enabled.

Since the tasklet is borrowing a stack, that process can't run until
the tasklet is finished, so to simplify things no context switches can
occur while tasklets are running.

If your kernel was configured with a separate irq stack, then it's
conceivable that tasklets could run essentially in a thread context.
But because not all architectures implement a separate hw irq stack,
and you want drivers and stuff to be portable, you have to cater to
the lowest common denominator.

If you want your tasklet to run in process context, then use a kernel
thread instead of a tasklet.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

      reply	other threads:[~2011-11-10 21:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 16:38 why tasklet cant sleep santhosh kumars
2011-11-10 21:06 ` Dave Hylands [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=CABi1daEw8_ifEtqgMABJQ7Unt2TFJFuYDmqGUQM+OvMM-M3sow@mail.gmail.com \
    --to=dhylands@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).