All of lore.kernel.org
 help / color / mirror / Atom feed
* why tasklet cant sleep
@ 2011-11-10 16:38 santhosh kumars
  2011-11-10 21:06 ` Dave Hylands
  0 siblings, 1 reply; 2+ messages in thread
From: santhosh kumars @ 2011-11-10 16:38 UTC (permalink / raw)
  To: kernelnewbies

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?
thanks,
karunakar.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* why tasklet cant sleep
  2011-11-10 16:38 why tasklet cant sleep santhosh kumars
@ 2011-11-10 21:06 ` Dave Hylands
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Hylands @ 2011-11-10 21:06 UTC (permalink / raw)
  To: kernelnewbies

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-10 21:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-10 16:38 why tasklet cant sleep santhosh kumars
2011-11-10 21:06 ` Dave Hylands

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.