Queries on bottom halves

Larry Chen lchen at suse.com
Sun Sep 2 06:54:42 EDT 2018


Hello Abhinav,

On 09/01/2018 04:05 PM, Abhinav Misra wrote:
> Hi,
> 
> Sorry for the delay in the reply.
> I think the question is not correctly framed. Will try to do it again.
> 
> 1. Which stack does the tasklet, softriq and workqueue use for their 
> execution ?
> 

Softirq actually is a group of N kernel threads(N equals to your cpu 
number), each thread is restricted to run on its corresponding cpu.

A tasklet is a call-back function that runs on softirq thread.

In the latest kernel version, a tasklet uses softirq thread stack.

A workqueue is almost the same, a work is almost the same as the a 
tasklet, it runs on a worker thread and shares the stack with worker thread.


> 2. Why can't we sleep in tasklet and softriq ?
Yes, you can.
Tasklet runs on softirq thread, it has its own task_struct, you can 
sleep or call schedule in your tasklet.

When you sleep in your tasklet, the softirq thread that the tasklet is 
running on will sleep, the sequential tasklet could not be executed 
until next schedule.

BR,
Larry




More information about the Kernelnewbies mailing list