I am a Linux device driver newbie, and want to know the exact differences between tasklet and workqueue. I have the following doubts:
- Which kernel stack do interrupts, tasklet and workqueue use when running in interrupt/process context?
- At what priority would tasklet and workqueue run and can we modify it's priority?
- If I implement my own work queue list, can I schedule/prioritize it independently?
Tasklets:
Work queues:
Bottom line is: use tasklets for high priority, low latency atomic tasks that must still execute outside the hard IRQ context.
You can control some level of priority with tasklets using
tasklet_hi_enable/tasklet_hi_schedule(instead of their respective no-_hiversions). From this IBM page:With work queues, when creating one, you will use
alloc_workqueue(create_workqueueis deprecated) and can pass a flag to ask for higher priority:I cannot answer all your questions, but I hope this helps anyway.