Who raises this softirq? Is it raised on every time tick( based on timer interrupt?)

Does this make the kernel to shedule a runnable process? If yes, how does the handlers of lower priority softirqs (HR_TIMER,RCU_SOFTIRQ) run since the execution is now process context(after a schedule ())?


According to kernel documentations:

Software Interrupt Context: Softirqs and Tasklets
Whenever a system call is about to return to userspace, or a hardware interrupt handler exits, any 'software interrupts' which are marked pending (usually by hardware interrupts) are run (kernel/softirq.c).

Much of the real interrupt handling work is done here. Early in the transition to SMP, there were only 'bottom halves' (BHs), which didn't take advantage of multiple CPUs. Shortly after we switched from wind-up computers made of match-sticks and snot, we abandoned this limitation and switched to 'softirqs'.

include/linux/interrupt.h lists the different softirqs. A very important softirq is the timer softirq (include/linux/timer.h): you can register to have it call functions for you in a given length of time.

Softirqs are often a pain to deal with, since the same softirq will run simultaneously on more than one CPU. For this reason, tasklets (include/linux/interrupt.h) are more often used: they are dynamically-registrable (meaning you can have as many as you want), and they also guarantee that any tasklet will only run on one CPU at any time, although different tasklets can run simultaneously.

The name 'tasklet' is misleading: they have nothing to do with 'tasks', and probably more to do with some bad vodka Alexey Kuznetsov had at the time.

You can tell you are in a softirq (or tasklet) using the in_softirq() macro (include/linux/interrupt.h).

Beware that this will return a false positive if a bh lock (see below) is held.

  • Also visit the lwn.net/Articles/520076 – PersianGulf Jan 28 '15 at 13:47
  • Could you please be more specific to my question regarding sched_softirq? – Sreejith M M Jan 28 '15 at 14:31
  • I have a good suggesstion: download source of kernel and read include/linux/interrupt.h and its implementation. – PersianGulf Jan 28 '15 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.