lockref: Use BLOATED_SPINLOCKS to avoid explicit config dependencies
Subsystems (2)
PATCH 1/1 lockref: Use BLOATED_SPINLOCKS to avoid explicit config dependencies
From: Peter Zijlstra <[email protected]>
Avoid the fragile Kconfig construct guestimating spinlock_t sizes; use a friendly compile-time test to determine this.
Signed-off-by Peter Zijlstra <[email protected]>
[[email protected]: drop CONFIG_CMPXCHG_LOCKREF]
Signed-off-by Kirill A. Shutemov <[email protected]>
--- include/linux/lockref.h | 7 ++++++- lib/Kconfig | 7 ------- lib/lockref.c | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-)
include/linux/lockref.h +6 -1
@@ -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 {
lib/Kconfig +0 -7
@@ -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
lib/lockref.c +1 -1
@@ -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
Signature · 1 line
1.8.4.2