aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/interrupt.h
diff options
context:
space:
mode:
authorTanner Love <tannerlove@google.com>2021-06-02 14:03:38 -0400
committerThomas Gleixner <tglx@linutronix.de>2021-08-10 22:50:07 +0200
commit91cc470e797828d779cd4c1efbe8519bcb358bae (patch)
tree9f36cb2595cd78a8d9938d002800fb0bf7e9d8a6 /include/linux/interrupt.h
parentgenirq/generic_chip: Use struct_size() in kzalloc() (diff)
downloadwireguard-linux-91cc470e797828d779cd4c1efbe8519bcb358bae.tar.xz
wireguard-linux-91cc470e797828d779cd4c1efbe8519bcb358bae.zip
genirq: Change force_irqthreads to a static key
With CONFIG_IRQ_FORCED_THREADING=y, testing the boolean force_irqthreads could incur a cache line miss in invoke_softirq() and other places. Replace the test with a static key to avoid the potential cache miss. [ tglx: Dropped the IDE part, removed the export and updated blk-mq ] Suggested-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Tanner Love <tannerlove@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20210602180338.3324213-1-tannerlove.kernel@gmail.com
Diffstat (limited to 'include/linux/interrupt.h')
-rw-r--r--include/linux/interrupt.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2ed65b01c961..1f22a30c0963 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -13,6 +13,7 @@
#include <linux/hrtimer.h>
#include <linux/kref.h>
#include <linux/workqueue.h>
+#include <linux/jump_label.h>
#include <linux/atomic.h>
#include <asm/ptrace.h>
@@ -474,12 +475,13 @@ extern int irq_set_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
#ifdef CONFIG_IRQ_FORCED_THREADING
# ifdef CONFIG_PREEMPT_RT
-# define force_irqthreads (true)
+# define force_irqthreads() (true)
# else
-extern bool force_irqthreads;
+DECLARE_STATIC_KEY_FALSE(force_irqthreads_key);
+# define force_irqthreads() (static_branch_unlikely(&force_irqthreads_key))
# endif
#else
-#define force_irqthreads (0)
+#define force_irqthreads() (false)
#endif
#ifndef local_softirq_pending