aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/qspinlock_types.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2018-06-22 21:20:35 +0200
committerThomas Gleixner <tglx@linutronix.de>2018-06-22 21:20:35 +0200
commit7731b8bc94e599c9a79e428f3359ff2c34b7576a (patch)
tree879f18ccbe274122f2d4f095b43cbc7f953e0ada /include/asm-generic/qspinlock_types.h
parentMAINTAINERS: Add file patterns for x86 device tree bindings (diff)
parentMerge tag '4.18-rc1-more-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 (diff)
downloadlinux-dev-7731b8bc94e599c9a79e428f3359ff2c34b7576a.tar.xz
linux-dev-7731b8bc94e599c9a79e428f3359ff2c34b7576a.zip
Merge branch 'linus' into x86/urgent
Required to queue a dependent fix.
Diffstat (limited to 'include/asm-generic/qspinlock_types.h')
-rw-r--r--include/asm-generic/qspinlock_types.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/include/asm-generic/qspinlock_types.h b/include/asm-generic/qspinlock_types.h
index 034acd0c4956..0763f065b975 100644
--- a/include/asm-generic/qspinlock_types.h
+++ b/include/asm-generic/qspinlock_types.h
@@ -29,13 +29,41 @@
#endif
typedef struct qspinlock {
- atomic_t val;
+ union {
+ atomic_t val;
+
+ /*
+ * By using the whole 2nd least significant byte for the
+ * pending bit, we can allow better optimization of the lock
+ * acquisition for the pending bit holder.
+ */
+#ifdef __LITTLE_ENDIAN
+ struct {
+ u8 locked;
+ u8 pending;
+ };
+ struct {
+ u16 locked_pending;
+ u16 tail;
+ };
+#else
+ struct {
+ u16 tail;
+ u16 locked_pending;
+ };
+ struct {
+ u8 reserved[2];
+ u8 pending;
+ u8 locked;
+ };
+#endif
+ };
} arch_spinlock_t;
/*
* Initializier
*/
-#define __ARCH_SPIN_LOCK_UNLOCKED { ATOMIC_INIT(0) }
+#define __ARCH_SPIN_LOCK_UNLOCKED { .val = ATOMIC_INIT(0) }
/*
* Bitfields in the atomic value: