aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/spinlock.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-08-15 23:28:23 +0200
committerIngo Molnar <mingo@kernel.org>2021-08-17 17:43:24 +0200
commit342a93247e0837101f27bbcca26f402902df98dc (patch)
treee7e298f8a4fba435fd8164a82d96f77e6dfa467f /include/linux/spinlock.h
parentlocking/spinlock: Provide RT specific spinlock_t (diff)
downloadwireguard-linux-342a93247e0837101f27bbcca26f402902df98dc.tar.xz
wireguard-linux-342a93247e0837101f27bbcca26f402902df98dc.zip
locking/spinlock: Provide RT variant header: <linux/spinlock_rt.h>
Provide the necessary wrappers around the actual rtmutex based spinlock implementation. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210815211303.712897671@linutronix.de
Diffstat (limited to 'include/linux/spinlock.h')
-rw-r--r--include/linux/spinlock.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 5803b56622a8..45310ea1b1d7 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -312,8 +312,10 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
1 : ({ local_irq_restore(flags); 0; }); \
})
-/* Include rwlock functions */
+#ifndef CONFIG_PREEMPT_RT
+/* Include rwlock functions for !RT */
#include <linux/rwlock.h>
+#endif
/*
* Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
@@ -324,6 +326,9 @@ static inline void do_raw_spin_unlock(raw_spinlock_t *lock) __releases(lock)
# include <linux/spinlock_api_up.h>
#endif
+/* Non PREEMPT_RT kernel, map to raw spinlocks: */
+#ifndef CONFIG_PREEMPT_RT
+
/*
* Map the spin_lock functions to the raw variants for PREEMPT_RT=n
*/
@@ -458,6 +463,10 @@ static __always_inline int spin_is_contended(spinlock_t *lock)
#define assert_spin_locked(lock) assert_raw_spin_locked(&(lock)->rlock)
+#else /* !CONFIG_PREEMPT_RT */
+# include <linux/spinlock_rt.h>
+#endif /* CONFIG_PREEMPT_RT */
+
/*
* Pull the atomic_t declaration:
* (asm-mips/atomic.h needs above definitions)