lockref: use BLOATED_SPINLOCKS to avoid explicit config dependencies
authorPeter Zijlstra <peterz@infradead.org>
Thu, 14 Nov 2013 22:31:54 +0000 (14:31 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 15 Nov 2013 00:32:20 +0000 (09:32 +0900)
Avoid the fragile Kconfig construct guestimating spinlock_t sizes; use a
friendly compile-time test to determine this.

[kirill.shutemov@linux.intel.com: drop CONFIG_CMPXCHG_LOCKREF]
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/lockref.h
lib/Kconfig
lib/lockref.c

index 13dfd36a329474df228102dd49bafbdf1b5c687d..c8929c3832db26d00d80f96e524afbb0e75c4df1 100644 (file)
  */
 
 #include <linux/spinlock.h>
+#include <generated/bounds.h>
+
+#define USE_CMPXCHG_LOCKREF \
+       (IS_ENABLED(CONFIG_ARCH_USE_CMPXCHG_LOCKREF) && \
+        IS_ENABLED(CONFIG_SMP) && !BLOATED_SPINLOCKS)
 
 struct lockref {
        union {
-#ifdef CONFIG_CMPXCHG_LOCKREF
+#if USE_CMPXCHG_LOCKREF
                aligned_u64 lock_count;
 #endif
                struct {
index 75485e163ca3bc8e807c10f7fdf2c761a7df377f..06dc74200a5159c5b5458c36e2b71297e638a194 100644 (file)
@@ -51,13 +51,6 @@ config PERCPU_RWSEM
 config ARCH_USE_CMPXCHG_LOCKREF
        bool
 
-config CMPXCHG_LOCKREF
-       def_bool y if ARCH_USE_CMPXCHG_LOCKREF
-       depends on SMP
-       depends on !GENERIC_LOCKBREAK
-       depends on !DEBUG_SPINLOCK
-       depends on !DEBUG_LOCK_ALLOC
-
 config CRC_CCITT
        tristate "CRC-CCITT functions"
        help
index af6e95d0bed6122bf9fd1e4af2bd76a4e2be62b3..d2b123f8456b22479681d4512fbb8c1e445a0158 100644 (file)
@@ -1,7 +1,7 @@
 #include <linux/export.h>
 #include <linux/lockref.h>
 
-#ifdef CONFIG_CMPXCHG_LOCKREF
+#if USE_CMPXCHG_LOCKREF
 
 /*
  * Allow weakly-ordered memory architectures to provide barrier-less