c - What is the difference between tasklet and workqueue -
i linux device driver newbie, , want know exact differences between tasklet
, workqueue
. additionally have following doubts too:
- which kernel stack interrupts, tasklet , workqueue use when running in interrupt/process context?
- at priority tasklet , workqueue run , can modify it's priority?
- if implement own work queue list, can schedule/prioritize independently?
tasklets:
- are old (around 2.3 believe)
- have straightforward, simple api
- are designed low latency
- cannot sleep (run atomically in soft irq context , guaranteed never run on more 1 cpu of given processor, given tasklet)
work queues:
- are more recent (introduced in 2.5)
- have flexible api (more options/flags supported)
- are designed higher latency
- can sleep
bottom line is: use tasklets high priority, low latency atomic tasks must still execute outside hard irq context.
you can control level of priority tasklets using tasklet_hi_enable
/tasklet_hi_schedule
(instead of respective no-_hi
versions). this ibm page:
the normal-priority schedule performed through tasklet_softirq-level softirq, high priority through hi_softirq-level softirq.
...
tasklets high-priority vector serviced first, followed on normal vector. note each cpu maintains own normal , high-priority softirq vectors.
with work queues, when creating one, use alloc_workqueue
(create_workqueue
deprecated) , can pass flag ask higher priority:
wq_highpri:
work items of highpri wq queued highpri thread-pool of target gcwq. highpri thread-pools served worker threads elevated nice level.
note normal , highpri thread-pools don't interact each other. each maintain separate pool of workers , implements concurrency management among workers.
i cannot answer questions, hope helps anyway.
Comments
Post a Comment