Which context are softirq and tasklet in?

kai picture kai · Aug 21, 2011 · Viewed 12.3k times · Source

I know that there are process context and interrupt context but I don't understand when executing softirq or tasklet, which context is it run under.

I have seen some people use the term "bottom-halves context", if there's such term, what's the difference comparing with the others.

Another question to softirq and tasklet is that why sleep are not allowed during execution??

Can anyone help me identify these questions, thanks!!

Answer

user898756 picture user898756 · Aug 21, 2011

The softirq and tasklet are both kind of bottom-halves mechanism. Sleep is not allowed becuase they run under interrupt context not process context. If sleep is allowed, then the linux cannot schedule them and finally cause a kernel panic with a dequeue_task error. The interrupt context does not even have a data structure describing the register info, so they can never be scheduled by linux. If it is designed to have that structure and can be scheduled, the performance for interrupt handling process will be effected.