linux-kernelsoftirq

How kernel disable the softirq in the local processor when softirq handler runs


Recently I study the Linux-Kernel-Development by Robert Love.

There is a paragraph describes mechanism of softirq.

The softirq handlers run with interrupts enabled and cannot sleep. While a handler runs, softirqs on the current processor are disabled. Another processor, however, can execute other softirqs.

I don't understand the meaning of "softirqs on the current processor are disabled."

Does this mean that when running __do_softirq, even if some of the bit in the softirq_pending is raising again, the __do_softirq function cannot be interrupted? If yes then what statements in the __do_softirq do this kind of protection?

When tracing the code in __do_softirq, I found that there are a pair of __local_bh_disable and __local_bh_enable functions.

Do they disable the local softirq?

Thanks.


Solution

  • Yes, __local_bh_disable and __local_bh_enable disable and enable processing of softirqs on the current CPU. Softirqs are also known as "bottom halves", which is what the "bh" in those names represents.