2003-03-28 23:06:16

by J S

[permalink] [raw]
Subject: Tasklets vs. Task Queues for Deferred Processing

I'm trying to defer some processing to a later point. I'm in a softirq,
so in_interrupt() returns true. I need to schedule some work for later,
in process context. I have read in the O'Reilly linux device drivers
book that tasklets always run in interrupt time. Also, I guess the only
task_queue that is in process context is the scheduler task queue. I've
seen in a few places that task queues are on their way out and tasklets
are being used instead. Is this completely true? Should I consider
task queues as a deprecated method of deferred processing?` What other
deferred processing methods can I use that will run in process context?

Thanks,
Josh




2003-03-29 08:01:39

by Juergen Quade

[permalink] [raw]
Subject: Re: Tasklets vs. Task Queues for Deferred Processing

On Fri, Mar 28, 2003 at 06:14:37PM -0500, J S wrote:
> I'm trying to defer some processing to a later point. I'm in a softirq,
> so in_interrupt() returns true. I need to schedule some work for later,
> in process context. I have read in the O'Reilly linux device drivers
> book that tasklets always run in interrupt time. Also, I guess the only
> task_queue that is in process context is the scheduler task queue. I've
> seen in a few places that task queues are on their way out and tasklets
> are being used instead. Is this completely true? Should I consider

True.

> task queues as a deprecated method of deferred processing?` What other
> deferred processing methods can I use that will run in process context?

Beside application triggered driver functions (open, close, read,
write ...) you can (only) use kernel threads.
You can use "pure" kernel threads, workqueues or especially the
kevent-daemon (2.4.x) or the event-workqueue (2.5.x).

If you only need to call something like a short function, use
the work queue. Need more info?

Juergen.

2003-03-29 08:01:44

by Duncan Sands

[permalink] [raw]
Subject: Re: Tasklets vs. Task Queues for Deferred Processing

On Saturday 29 March 2003 00:14, J S wrote:
> I'm trying to defer some processing to a later point. I'm in a softirq,
> so in_interrupt() returns true. I need to schedule some work for later,
> in process context. I have read in the O'Reilly linux device drivers
> book that tasklets always run in interrupt time. Also, I guess the only
> task_queue that is in process context is the scheduler task queue. I've
> seen in a few places that task queues are on their way out and tasklets
> are being used instead. Is this completely true? Should I consider
> task queues as a deprecated method of deferred processing?` What other
> deferred processing methods can I use that will run in process context?

In 2.5, use a workqueue.

Duncan.

2003-03-29 21:37:04

by Jonathan Corbet

[permalink] [raw]
Subject: Re: Tasklets vs. Task Queues for Deferred Processing

> I have read in the O'Reilly linux device drivers
> book that tasklets always run in interrupt time. Also, I guess the only
> task_queue that is in process context is the scheduler task queue. I've
> seen in a few places that task queues are on their way out and tasklets
> are being used instead. Is this completely true?

All true. If you're developing for 2.4, you can use schedule_task() and
life will be OK. For 2.5, you really want to use work queues instead; see
http://lwn.net/Articles/23634/ for a description of how to do that.

jon

Jonathan Corbet
Executive editor, LWN.net
[email protected]