/*
* If we're in an interrupt or softirq, we're done
* (this also catches softirq-disabled code). We will
* actually run the softirq once we return from
* the irq or softirq.
*
* Otherwise we wake up ksoftirqd to make sure we
* schedule the softirq soon.
*/
if (!in_interrupt())
wakeup_softirqd();
}
#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
由紅色的代碼我們可以看到函數(shù)tasklet_schedule只是將每個(gè)cpu對(duì)應(yīng)的關(guān)于軟中斷的變量的那個(gè)關(guān)于tasklet的bit置成1,就結(jié)束了。
到此為止,我們再回想當(dāng)中斷處理程序完成之后,它會(huì)根據(jù)當(dāng)前是否有pending的softirq,此時(shí)有,因此函數(shù)tasklet_action就會(huì)被調(diào)用,原因是內(nèi)核初始化的時(shí)候有這么一條語句:open_softirq(TASKLET_SOFTIRQ, tasklet_action);。再看函數(shù)tasklet_action:
static void tasklet_action(struct softirq_action *a)
{
struct tasklet_struct *list;