Use lockdep to check that IRQs are enabled or disabled as expected. This way the sanity check only shows overhead when concurrency correctness debug code is enabled.
Unified · Split
| @@ -1376,7 +1376,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, · 1375 unmodified lines | ||
| 1376 | 1376 | * queued or lose PENDING. Grabbing PENDING and queueing should |
| 1377 | 1377 | * happen with IRQ disabled. |
| 1378 | 1378 | */ |
| 1379 | − WARN_ON_ONCE(!irqs_disabled()); | |
| 1379 | + lockdep_assert_irqs_disabled(); | |
| 1380 | 1380 | |
| 1381 | 1381 | debug_work_activate(work); |
| 1382 | 1382 | |