summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2013-11-14 14:31:54 -0800
committerMaciej Wereski <m.wereski@partner.samsung.com>2015-06-09 11:30:57 +0200
commit5f0559733eb4d3ca8d0a362598cca53fc4a60508 (patch)
tree007737148e3095716a7f1e9d971b8e1840a35727
parentd15ea6a0c747244222043ea25c3280a2ffde7475 (diff)
downloadlinux-3.10-5f0559733eb4d3ca8d0a362598cca53fc4a60508.tar.gz
linux-3.10-5f0559733eb4d3ca8d0a362598cca53fc4a60508.tar.bz2
linux-3.10-5f0559733eb4d3ca8d0a362598cca53fc4a60508.zip
lockref: use BLOATED_SPINLOCKS to avoid explicit config dependencies
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>
-rw-r--r--include/linux/lockref.h7
-rw-r--r--lib/Kconfig7
-rw-r--r--lib/lockref.c2
3 files changed, 7 insertions, 9 deletions
diff --git a/include/linux/lockref.h b/include/linux/lockref.h
index 13dfd36a329..c8929c3832d 100644
--- a/include/linux/lockref.h
+++ b/include/linux/lockref.h
@@ -15,10 +15,15 @@
*/
#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 {
diff --git a/lib/Kconfig b/lib/Kconfig
index 62581eaa682..eda65414633 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -48,13 +48,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
diff --git a/lib/lockref.c b/lib/lockref.c
index caf79fdadd9..f88b3fa4494 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -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