Skip to contentSkip to conversation

Tasklets vs. Task Queues for Deferred Processing

DISCUSSION J S 4 participants 4 messages Mar 28, 2003 – Mar 29, 2003

lore
Share & tools
lore

J S

author
#0 lore raw

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

#1 lore raw
Quoted 7 lines · J S

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.

Quoted 2 lines

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.

#2 lore raw
In reply to J S
Quoted 9 lines · J S

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.

#3 lore raw
In reply to J S
Quoted 5 lines

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]