This commit explains why softirqs need to be disabled while invoking callbacks, even when callback processing has been offloaded. After all, invoking callbacks concurrently is one thing, but concurrently invoking the same callback is quite another.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -2235,6 +2235,12 @@ static void nocb_cb_wait(struct rcu_data *rdp) · 2234 unmodified lines | ||
| 2235 | 2235 | local_irq_save(flags); |
| 2236 | 2236 | rcu_momentary_dyntick_idle(); |
| 2237 | 2237 | local_irq_restore(flags); |
| 2238 | + /* | |
| 2239 | + * Disable BH to provide the expected environment. Also, when | |
| 2240 | + * transitioning to/from NOCB mode, a self-requeuing callback might | |
| 2241 | + * be invoked from softirq. A short grace period could cause both | |
| 2242 | + * instances of this callback would execute concurrently. | |
| 2243 | + */ | |
| 2238 | 2244 | local_bh_disable(); |
| 2239 | 2245 | rcu_do_batch(rdp); |
| 2240 | 2246 | local_bh_enable(); |