aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2009-11-09 10:21:34 -0500
committerThomas Gleixner <tglx@linutronix.de>2009-11-13 14:53:28 -0500
commit6beb000923882f6204ea2cfcd932e568e900803f (patch)
tree1849bb1e7493bbf5e538d74cec18c6d6f4b16ced
parent156171c71a0dc4bce12b4408bb1591f8fe32dc1a (diff)
locking: Make inlining decision Kconfig based
commit 892a7c67 (locking: Allow arch-inlined spinlocks) implements the selection of which lock functions are inlined based on defines in arch/.../spinlock.h: #define __always_inline__LOCK_FUNCTION Despite of the name __always_inline__* the lock functions can be built out of line depending on config options. Also if the arch does not set some inline defines the generic code might set them; again depending on config options. This makes it unnecessary hard to figure out when and which lock functions are inlined. Aside of that it makes it way harder and messier for -rt to manipulate the lock functions. Convert the inlining decision to CONFIG switches. Each lock function is inlined depending on CONFIG_INLINE_*. The configs implement the existing dependencies. The architecture code can select ARCH_INLINE_* to signal that it wants the corresponding lock function inlined. ARCH_INLINE_* is necessary as Kconfig ignores "depends on" restrictions when a config element is selected. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> LKML-Reference: <20091109151428.504477141@linutronix.de> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> Reviewed-by: Ingo Molnar <mingo@elte.hu> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
-rw-r--r--arch/s390/Kconfig28
-rw-r--r--arch/s390/include/asm/spinlock.h29
-rw-r--r--include/linux/spinlock_api_smp.h75
-rw-r--r--init/Kconfig1
-rw-r--r--kernel/Kconfig.locks199
-rw-r--r--kernel/spinlock.c56
6 files changed, 284 insertions, 104 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 43c0acad7160..16c673096a22 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -95,6 +95,34 @@ config S390
95 select HAVE_ARCH_TRACEHOOK 95 select HAVE_ARCH_TRACEHOOK
96 select INIT_ALL_POSSIBLE 96 select INIT_ALL_POSSIBLE
97 select HAVE_PERF_EVENTS 97 select HAVE_PERF_EVENTS
98 select ARCH_INLINE_SPIN_TRYLOCK
99 select ARCH_INLINE_SPIN_TRYLOCK_BH
100 select ARCH_INLINE_SPIN_LOCK
101 select ARCH_INLINE_SPIN_LOCK_BH
102 select ARCH_INLINE_SPIN_LOCK_IRQ
103 select ARCH_INLINE_SPIN_LOCK_IRQSAVE
104 select ARCH_INLINE_SPIN_UNLOCK
105 select ARCH_INLINE_SPIN_UNLOCK_BH
106 select ARCH_INLINE_SPIN_UNLOCK_IRQ
107 select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE
108 select ARCH_INLINE_READ_TRYLOCK
109 select ARCH_INLINE_READ_LOCK
110 select ARCH_INLINE_READ_LOCK_BH
111 select ARCH_INLINE_READ_LOCK_IRQ
112 select ARCH_INLINE_READ_LOCK_IRQSAVE
113 select ARCH_INLINE_READ_UNLOCK
114 select ARCH_INLINE_READ_UNLOCK_BH
115 select ARCH_INLINE_READ_UNLOCK_IRQ
116 select ARCH_INLINE_READ_UNLOCK_IRQRESTORE
117 select ARCH_INLINE_WRITE_TRYLOCK
118 select ARCH_INLINE_WRITE_LOCK
119 select ARCH_INLINE_WRITE_LOCK_BH
120 select ARCH_INLINE_WRITE_LOCK_IRQ
121 select ARCH_INLINE_WRITE_LOCK_IRQSAVE
122 select ARCH_INLINE_WRITE_UNLOCK
123 select ARCH_INLINE_WRITE_UNLOCK_BH
124 select ARCH_INLINE_WRITE_UNLOCK_IRQ
125 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
98 126
99config SCHED_OMIT_FRAME_POINTER 127config SCHED_OMIT_FRAME_POINTER
100 bool 128 bool
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h
index 41ce6861174e..c9af0d19c7ab 100644
--- a/arch/s390/include/asm/spinlock.h
+++ b/arch/s390/include/asm/spinlock.h
@@ -191,33 +191,4 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw)
191#define _raw_read_relax(lock) cpu_relax() 191#define _raw_read_relax(lock) cpu_relax()
192#define _raw_write_relax(lock) cpu_relax() 192#define _raw_write_relax(lock) cpu_relax()
193 193
194#define __always_inline__spin_lock
195#define __always_inline__read_lock
196#define __always_inline__write_lock
197#define __always_inline__spin_lock_bh
198#define __always_inline__read_lock_bh
199#define __always_inline__write_lock_bh
200#define __always_inline__spin_lock_irq
201#define __always_inline__read_lock_irq
202#define __always_inline__write_lock_irq
203#define __always_inline__spin_lock_irqsave
204#define __always_inline__read_lock_irqsave
205#define __always_inline__write_lock_irqsave
206#define __always_inline__spin_trylock
207#define __always_inline__read_trylock
208#define __always_inline__write_trylock
209#define __always_inline__spin_trylock_bh
210#define __always_inline__spin_unlock
211#define __always_inline__read_unlock
212#define __always_inline__write_unlock
213#define __always_inline__spin_unlock_bh
214#define __always_inline__read_unlock_bh
215#define __always_inline__write_unlock_bh
216#define __always_inline__spin_unlock_irq
217#define __always_inline__read_unlock_irq
218#define __always_inline__write_unlock_irq
219#define __always_inline__spin_unlock_irqrestore
220#define __always_inline__read_unlock_irqrestore
221#define __always_inline__write_unlock_irqrestore
222
223#endif /* __ASM_SPINLOCK_H */ 194#endif /* __ASM_SPINLOCK_H */
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 7a7e18fc2415..8264a7f459bc 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -60,137 +60,118 @@ void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
60void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 60void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
61 __releases(lock); 61 __releases(lock);
62 62
63/* 63#ifdef CONFIG_INLINE_SPIN_LOCK
64 * We inline the unlock functions in the nondebug case:
65 */
66#if !defined(CONFIG_DEBUG_SPINLOCK) && !defined(CONFIG_PREEMPT)
67#define __always_inline__spin_unlock
68#define __always_inline__read_unlock
69#define __always_inline__write_unlock
70#define __always_inline__spin_unlock_irq
71#define __always_inline__read_unlock_irq
72#define __always_inline__write_unlock_irq
73#endif
74
75#ifndef CONFIG_DEBUG_SPINLOCK
76#ifndef CONFIG_GENERIC_LOCKBREAK
77
78#ifdef __always_inline__spin_lock
79#define _spin_lock(lock) __spin_lock(lock) 64#define _spin_lock(lock) __spin_lock(lock)
80#endif 65#endif
81 66
82#ifdef __always_inline__read_lock 67#ifdef CONFIG_INLINE_READ_LOCK
83#define _read_lock(lock) __read_lock(lock) 68#define _read_lock(lock) __read_lock(lock)
84#endif 69#endif
85 70
86#ifdef __always_inline__write_lock 71#ifdef CONFIG_INLINE_WRITE_LOCK
87#define _write_lock(lock) __write_lock(lock) 72#define _write_lock(lock) __write_lock(lock)
88#endif 73#endif
89 74
90#ifdef __always_inline__spin_lock_bh 75#ifdef CONFIG_INLINE_SPIN_LOCK_BH
91#define _spin_lock_bh(lock) __spin_lock_bh(lock) 76#define _spin_lock_bh(lock) __spin_lock_bh(lock)
92#endif 77#endif
93 78
94#ifdef __always_inline__read_lock_bh 79#ifdef CONFIG_INLINE_READ_LOCK_BH
95#define _read_lock_bh(lock) __read_lock_bh(lock) 80#define _read_lock_bh(lock) __read_lock_bh(lock)
96#endif 81#endif
97 82
98#ifdef __always_inline__write_lock_bh 83#ifdef CONFIG_INLINE_WRITE_LOCK_BH
99#define _write_lock_bh(lock) __write_lock_bh(lock) 84#define _write_lock_bh(lock) __write_lock_bh(lock)
100#endif 85#endif
101 86
102#ifdef __always_inline__spin_lock_irq 87#ifdef CONFIG_INLINE_SPIN_LOCK_IRQ
103#define _spin_lock_irq(lock) __spin_lock_irq(lock) 88#define _spin_lock_irq(lock) __spin_lock_irq(lock)
104#endif 89#endif
105 90
106#ifdef __always_inline__read_lock_irq 91#ifdef CONFIG_INLINE_READ_LOCK_IRQ
107#define _read_lock_irq(lock) __read_lock_irq(lock) 92#define _read_lock_irq(lock) __read_lock_irq(lock)
108#endif 93#endif
109 94
110#ifdef __always_inline__write_lock_irq 95#ifdef CONFIG_INLINE_WRITE_LOCK_IRQ
111#define _write_lock_irq(lock) __write_lock_irq(lock) 96#define _write_lock_irq(lock) __write_lock_irq(lock)
112#endif 97#endif
113 98
114#ifdef __always_inline__spin_lock_irqsave 99#ifdef CONFIG_INLINE_SPIN_LOCK_IRQSAVE
115#define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock) 100#define _spin_lock_irqsave(lock) __spin_lock_irqsave(lock)
116#endif 101#endif
117 102
118#ifdef __always_inline__read_lock_irqsave 103#ifdef CONFIG_INLINE_READ_LOCK_IRQSAVE
119#define _read_lock_irqsave(lock) __read_lock_irqsave(lock) 104#define _read_lock_irqsave(lock) __read_lock_irqsave(lock)
120#endif 105#endif
121 106
122#ifdef __always_inline__write_lock_irqsave 107#ifdef CONFIG_INLINE_WRITE_LOCK_IRQSAVE
123#define _write_lock_irqsave(lock) __write_lock_irqsave(lock) 108#define _write_lock_irqsave(lock) __write_lock_irqsave(lock)
124#endif 109#endif
125 110
126#endif /* !CONFIG_GENERIC_LOCKBREAK */ 111#ifdef CONFIG_INLINE_SPIN_TRYLOCK
127
128#ifdef __always_inline__spin_trylock
129#define _spin_trylock(lock) __spin_trylock(lock) 112#define _spin_trylock(lock) __spin_trylock(lock)
130#endif 113#endif
131 114
132#ifdef __always_inline__read_trylock 115#ifdef CONFIG_INLINE_READ_TRYLOCK
133#define _read_trylock(lock) __read_trylock(lock) 116#define _read_trylock(lock) __read_trylock(lock)
134#endif 117#endif
135 118
136#ifdef __always_inline__write_trylock 119#ifdef CONFIG_INLINE_WRITE_TRYLOCK
137#define _write_trylock(lock) __write_trylock(lock) 120#define _write_trylock(lock) __write_trylock(lock)
138#endif 121#endif
139 122
140#ifdef __always_inline__spin_trylock_bh 123#ifdef CONFIG_INLINE_SPIN_TRYLOCK_BH
141#define _spin_trylock_bh(lock) __spin_trylock_bh(lock) 124#define _spin_trylock_bh(lock) __spin_trylock_bh(lock)
142#endif 125#endif
143 126
144#ifdef __always_inline__spin_unlock 127#ifdef CONFIG_INLINE_SPIN_UNLOCK
145#define _spin_unlock(lock) __spin_unlock(lock) 128#define _spin_unlock(lock) __spin_unlock(lock)
146#endif 129#endif
147 130
148#ifdef __always_inline__read_unlock 131#ifdef CONFIG_INLINE_READ_UNLOCK
149#define _read_unlock(lock) __read_unlock(lock) 132#define _read_unlock(lock) __read_unlock(lock)
150#endif 133#endif
151 134
152#ifdef __always_inline__write_unlock 135#ifdef CONFIG_INLINE_WRITE_UNLOCK
153#define _write_unlock(lock) __write_unlock(lock) 136#define _write_unlock(lock) __write_unlock(lock)
154#endif 137#endif
155 138
156#ifdef __always_inline__spin_unlock_bh 139#ifdef CONFIG_INLINE_SPIN_UNLOCK_BH
157#define _spin_unlock_bh(lock) __spin_unlock_bh(lock) 140#define _spin_unlock_bh(lock) __spin_unlock_bh(lock)
158#endif 141#endif
159 142
160#ifdef __always_inline__read_unlock_bh 143#ifdef CONFIG_INLINE_READ_UNLOCK_BH
161#define _read_unlock_bh(lock) __read_unlock_bh(lock) 144#define _read_unlock_bh(lock) __read_unlock_bh(lock)
162#endif 145#endif
163 146
164#ifdef __always_inline__write_unlock_bh 147#ifdef CONFIG_INLINE_WRITE_UNLOCK_BH
165#define _write_unlock_bh(lock) __write_unlock_bh(lock) 148#define _write_unlock_bh(lock) __write_unlock_bh(lock)
166#endif 149#endif
167 150
168#ifdef __always_inline__spin_unlock_irq 151#ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQ
169#define _spin_unlock_irq(lock) __spin_unlock_irq(lock) 152#define _spin_unlock_irq(lock) __spin_unlock_irq(lock)
170#endif 153#endif
171 154
172#ifdef __always_inline__read_unlock_irq 155#ifdef CONFIG_INLINE_READ_UNLOCK_IRQ
173#define _read_unlock_irq(lock) __read_unlock_irq(lock) 156#define _read_unlock_irq(lock) __read_unlock_irq(lock)
174#endif 157#endif
175 158
176#ifdef __always_inline__write_unlock_irq 159#ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQ
177#define _write_unlock_irq(lock) __write_unlock_irq(lock) 160#define _write_unlock_irq(lock) __write_unlock_irq(lock)
178#endif 161#endif
179 162
180#ifdef __always_inline__spin_unlock_irqrestore 163#ifdef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE
181#define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags) 164#define _spin_unlock_irqrestore(lock, flags) __spin_unlock_irqrestore(lock, flags)
182#endif 165#endif
183 166
184#ifdef __always_inline__read_unlock_irqrestore 167#ifdef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE
185#define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags) 168#define _read_unlock_irqrestore(lock, flags) __read_unlock_irqrestore(lock, flags)
186#endif 169#endif
187 170
188#ifdef __always_inline__write_unlock_irqrestore 171#ifdef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE
189#define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags) 172#define _write_unlock_irqrestore(lock, flags) __write_unlock_irqrestore(lock, flags)
190#endif 173#endif
191 174
192#endif /* CONFIG_DEBUG_SPINLOCK */
193
194static inline int __spin_trylock(spinlock_t *lock) 175static inline int __spin_trylock(spinlock_t *lock)
195{ 176{
196 preempt_disable(); 177 preempt_disable();
diff --git a/init/Kconfig b/init/Kconfig
index 9e03ef8b311e..06863dd7bf49 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1210,3 +1210,4 @@ source "block/Kconfig"
1210config PREEMPT_NOTIFIERS 1210config PREEMPT_NOTIFIERS
1211 bool 1211 bool
1212 1212
1213source "kernel/Kconfig.locks"
diff --git a/kernel/Kconfig.locks b/kernel/Kconfig.locks
new file mode 100644
index 000000000000..d1f86db71451
--- /dev/null
+++ b/kernel/Kconfig.locks
@@ -0,0 +1,199 @@
1#
2# The ARCH_INLINE foo is necessary because select ignores "depends on"
3#
4config ARCH_INLINE_SPIN_TRYLOCK
5 bool
6
7config ARCH_INLINE_SPIN_TRYLOCK_BH
8 bool
9
10config ARCH_INLINE_SPIN_LOCK
11 bool
12
13config ARCH_INLINE_SPIN_LOCK_BH
14 bool
15
16config ARCH_INLINE_SPIN_LOCK_IRQ
17 bool
18
19config ARCH_INLINE_SPIN_LOCK_IRQSAVE
20 bool
21
22config ARCH_INLINE_SPIN_UNLOCK
23 bool
24
25config ARCH_INLINE_SPIN_UNLOCK_BH
26 bool
27
28config ARCH_INLINE_SPIN_UNLOCK_IRQ
29 bool
30
31config ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE
32 bool
33
34
35config ARCH_INLINE_READ_TRYLOCK
36 bool
37
38config ARCH_INLINE_READ_LOCK
39 bool
40
41config ARCH_INLINE_READ_LOCK_BH
42 bool
43
44config ARCH_INLINE_READ_LOCK_IRQ
45 bool
46
47config ARCH_INLINE_READ_LOCK_IRQSAVE
48 bool
49
50config ARCH_INLINE_READ_UNLOCK
51 bool
52
53config ARCH_INLINE_READ_UNLOCK_BH
54 bool
55
56config ARCH_INLINE_READ_UNLOCK_IRQ
57 bool
58
59config ARCH_INLINE_READ_UNLOCK_IRQRESTORE
60 bool
61
62
63config ARCH_INLINE_WRITE_TRYLOCK
64 bool
65
66config ARCH_INLINE_WRITE_LOCK
67 bool
68
69config ARCH_INLINE_WRITE_LOCK_BH
70 bool
71
72config ARCH_INLINE_WRITE_LOCK_IRQ
73 bool
74
75config ARCH_INLINE_WRITE_LOCK_IRQSAVE
76 bool
77
78config ARCH_INLINE_WRITE_UNLOCK
79 bool
80
81config ARCH_INLINE_WRITE_UNLOCK_BH
82 bool
83
84config ARCH_INLINE_WRITE_UNLOCK_IRQ
85 bool
86
87config ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
88 bool
89
90#
91# lock_* functions are inlined when:
92# - DEBUG_SPINLOCK=n and GENERIC_LOCKBREAK=n and ARCH_INLINE_*LOCK=y
93#
94# trylock_* functions are inlined when:
95# - DEBUG_SPINLOCK=n and ARCH_INLINE_*LOCK=y
96#
97# unlock and unlock_irq functions are inlined when:
98# - DEBUG_SPINLOCK=n and ARCH_INLINE_*LOCK=y
99# or
100# - DEBUG_SPINLOCK=n and PREEMPT=n
101#
102# unlock_bh and unlock_irqrestore functions are inlined when:
103# - DEBUG_SPINLOCK=n and ARCH_INLINE_*LOCK=y
104#
105
106config INLINE_SPIN_TRYLOCK
107 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_SPIN_TRYLOCK
108
109config INLINE_SPIN_TRYLOCK_BH
110 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_SPIN_TRYLOCK_BH
111
112config INLINE_SPIN_LOCK
113 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && ARCH_INLINE_SPIN_LOCK
114
115config INLINE_SPIN_LOCK_BH
116 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
117 ARCH_INLINE_SPIN_LOCK_BH
118
119config INLINE_SPIN_LOCK_IRQ
120 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
121 ARCH_INLINE_SPIN_LOCK_IRQ
122
123config INLINE_SPIN_LOCK_IRQSAVE
124 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
125 ARCH_INLINE_SPIN_LOCK_IRQSAVE
126
127config INLINE_SPIN_UNLOCK
128 def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_SPIN_UNLOCK)
129
130config INLINE_SPIN_UNLOCK_BH
131 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_SPIN_UNLOCK_BH
132
133config INLINE_SPIN_UNLOCK_IRQ
134 def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_SPIN_UNLOCK_BH)
135
136config INLINE_SPIN_UNLOCK_IRQRESTORE
137 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE
138
139
140config INLINE_READ_TRYLOCK
141 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_READ_TRYLOCK
142
143config INLINE_READ_LOCK
144 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && ARCH_INLINE_READ_LOCK
145
146config INLINE_READ_LOCK_BH
147 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
148 ARCH_INLINE_READ_LOCK_BH
149
150config INLINE_READ_LOCK_IRQ
151 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
152 ARCH_INLINE_READ_LOCK_IRQ
153
154config INLINE_READ_LOCK_IRQSAVE
155 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
156 ARCH_INLINE_READ_LOCK_IRQSAVE
157
158config INLINE_READ_UNLOCK
159 def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_READ_UNLOCK)
160
161config INLINE_READ_UNLOCK_BH
162 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_READ_UNLOCK_BH
163
164config INLINE_READ_UNLOCK_IRQ
165 def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_READ_UNLOCK_BH)
166
167config INLINE_READ_UNLOCK_IRQRESTORE
168 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_READ_UNLOCK_IRQRESTORE
169
170
171config INLINE_WRITE_TRYLOCK
172 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_WRITE_TRYLOCK
173
174config INLINE_WRITE_LOCK
175 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && ARCH_INLINE_WRITE_LOCK
176
177config INLINE_WRITE_LOCK_BH
178 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
179 ARCH_INLINE_WRITE_LOCK_BH
180
181config INLINE_WRITE_LOCK_IRQ
182 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
183 ARCH_INLINE_WRITE_LOCK_IRQ
184
185config INLINE_WRITE_LOCK_IRQSAVE
186 def_bool !DEBUG_SPINLOCK && !GENERIC_LOCKBREAK && \
187 ARCH_INLINE_WRITE_LOCK_IRQSAVE
188
189config INLINE_WRITE_UNLOCK
190 def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_WRITE_UNLOCK)
191
192config INLINE_WRITE_UNLOCK_BH
193 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_WRITE_UNLOCK_BH
194
195config INLINE_WRITE_UNLOCK_IRQ
196 def_bool !DEBUG_SPINLOCK && (!PREEMPT || ARCH_INLINE_WRITE_UNLOCK_BH)
197
198config INLINE_WRITE_UNLOCK_IRQRESTORE
199 def_bool !DEBUG_SPINLOCK && ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
diff --git a/kernel/spinlock.c b/kernel/spinlock.c
index 5ddab730cb2f..235a9579a875 100644
--- a/kernel/spinlock.c
+++ b/kernel/spinlock.c
@@ -21,7 +21,7 @@
21#include <linux/debug_locks.h> 21#include <linux/debug_locks.h>
22#include <linux/module.h> 22#include <linux/module.h>
23 23
24#ifndef _spin_trylock 24#ifndef CONFIG_INLINE_SPIN_TRYLOCK
25int __lockfunc _spin_trylock(spinlock_t *lock) 25int __lockfunc _spin_trylock(spinlock_t *lock)
26{ 26{
27 return __spin_trylock(lock); 27 return __spin_trylock(lock);
@@ -29,7 +29,7 @@ int __lockfunc _spin_trylock(spinlock_t *lock)
29EXPORT_SYMBOL(_spin_trylock); 29EXPORT_SYMBOL(_spin_trylock);
30#endif 30#endif
31 31
32#ifndef _read_trylock 32#ifndef CONFIG_INLINE_READ_TRYLOCK
33int __lockfunc _read_trylock(rwlock_t *lock) 33int __lockfunc _read_trylock(rwlock_t *lock)
34{ 34{
35 return __read_trylock(lock); 35 return __read_trylock(lock);
@@ -37,7 +37,7 @@ int __lockfunc _read_trylock(rwlock_t *lock)
37EXPORT_SYMBOL(_read_trylock); 37EXPORT_SYMBOL(_read_trylock);
38#endif 38#endif
39 39
40#ifndef _write_trylock 40#ifndef CONFIG_INLINE_WRITE_TRYLOCK
41int __lockfunc _write_trylock(rwlock_t *lock) 41int __lockfunc _write_trylock(rwlock_t *lock)
42{ 42{
43 return __write_trylock(lock); 43 return __write_trylock(lock);
@@ -52,7 +52,7 @@ EXPORT_SYMBOL(_write_trylock);
52 */ 52 */
53#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC) 53#if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC)
54 54
55#ifndef _read_lock 55#ifndef CONFIG_INLINE_READ_LOCK
56void __lockfunc _read_lock(rwlock_t *lock) 56void __lockfunc _read_lock(rwlock_t *lock)
57{ 57{
58 __read_lock(lock); 58 __read_lock(lock);
@@ -60,7 +60,7 @@ void __lockfunc _read_lock(rwlock_t *lock)
60EXPORT_SYMBOL(_read_lock); 60EXPORT_SYMBOL(_read_lock);
61#endif 61#endif
62 62
63#ifndef _spin_lock_irqsave 63#ifndef CONFIG_INLINE_SPIN_LOCK_IRQSAVE
64unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) 64unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
65{ 65{
66 return __spin_lock_irqsave(lock); 66 return __spin_lock_irqsave(lock);
@@ -68,7 +68,7 @@ unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
68EXPORT_SYMBOL(_spin_lock_irqsave); 68EXPORT_SYMBOL(_spin_lock_irqsave);
69#endif 69#endif
70 70
71#ifndef _spin_lock_irq 71#ifndef CONFIG_INLINE_SPIN_LOCK_IRQ
72void __lockfunc _spin_lock_irq(spinlock_t *lock) 72void __lockfunc _spin_lock_irq(spinlock_t *lock)
73{ 73{
74 __spin_lock_irq(lock); 74 __spin_lock_irq(lock);
@@ -76,7 +76,7 @@ void __lockfunc _spin_lock_irq(spinlock_t *lock)
76EXPORT_SYMBOL(_spin_lock_irq); 76EXPORT_SYMBOL(_spin_lock_irq);
77#endif 77#endif
78 78
79#ifndef _spin_lock_bh 79#ifndef CONFIG_INLINE_SPIN_LOCK_BH
80void __lockfunc _spin_lock_bh(spinlock_t *lock) 80void __lockfunc _spin_lock_bh(spinlock_t *lock)
81{ 81{
82 __spin_lock_bh(lock); 82 __spin_lock_bh(lock);
@@ -84,7 +84,7 @@ void __lockfunc _spin_lock_bh(spinlock_t *lock)
84EXPORT_SYMBOL(_spin_lock_bh); 84EXPORT_SYMBOL(_spin_lock_bh);
85#endif 85#endif
86 86
87#ifndef _read_lock_irqsave 87#ifndef CONFIG_INLINE_READ_LOCK_IRQSAVE
88unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) 88unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
89{ 89{
90 return __read_lock_irqsave(lock); 90 return __read_lock_irqsave(lock);
@@ -92,7 +92,7 @@ unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
92EXPORT_SYMBOL(_read_lock_irqsave); 92EXPORT_SYMBOL(_read_lock_irqsave);
93#endif 93#endif
94 94
95#ifndef _read_lock_irq 95#ifndef CONFIG_INLINE_READ_LOCK_IRQ
96void __lockfunc _read_lock_irq(rwlock_t *lock) 96void __lockfunc _read_lock_irq(rwlock_t *lock)
97{ 97{
98 __read_lock_irq(lock); 98 __read_lock_irq(lock);
@@ -100,7 +100,7 @@ void __lockfunc _read_lock_irq(rwlock_t *lock)
100EXPORT_SYMBOL(_read_lock_irq); 100EXPORT_SYMBOL(_read_lock_irq);
101#endif 101#endif
102 102
103#ifndef _read_lock_bh 103#ifndef CONFIG_INLINE_READ_LOCK_BH
104void __lockfunc _read_lock_bh(rwlock_t *lock) 104void __lockfunc _read_lock_bh(rwlock_t *lock)
105{ 105{
106 __read_lock_bh(lock); 106 __read_lock_bh(lock);
@@ -108,7 +108,7 @@ void __lockfunc _read_lock_bh(rwlock_t *lock)
108EXPORT_SYMBOL(_read_lock_bh); 108EXPORT_SYMBOL(_read_lock_bh);
109#endif 109#endif
110 110
111#ifndef _write_lock_irqsave 111#ifndef CONFIG_INLINE_WRITE_LOCK_IRQSAVE
112unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) 112unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
113{ 113{
114 return __write_lock_irqsave(lock); 114 return __write_lock_irqsave(lock);
@@ -116,7 +116,7 @@ unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
116EXPORT_SYMBOL(_write_lock_irqsave); 116EXPORT_SYMBOL(_write_lock_irqsave);
117#endif 117#endif
118 118
119#ifndef _write_lock_irq 119#ifndef CONFIG_INLINE_WRITE_LOCK_IRQ
120void __lockfunc _write_lock_irq(rwlock_t *lock) 120void __lockfunc _write_lock_irq(rwlock_t *lock)
121{ 121{
122 __write_lock_irq(lock); 122 __write_lock_irq(lock);
@@ -124,7 +124,7 @@ void __lockfunc _write_lock_irq(rwlock_t *lock)
124EXPORT_SYMBOL(_write_lock_irq); 124EXPORT_SYMBOL(_write_lock_irq);
125#endif 125#endif
126 126
127#ifndef _write_lock_bh 127#ifndef CONFIG_INLINE_WRITE_LOCK_BH
128void __lockfunc _write_lock_bh(rwlock_t *lock) 128void __lockfunc _write_lock_bh(rwlock_t *lock)
129{ 129{
130 __write_lock_bh(lock); 130 __write_lock_bh(lock);
@@ -132,7 +132,7 @@ void __lockfunc _write_lock_bh(rwlock_t *lock)
132EXPORT_SYMBOL(_write_lock_bh); 132EXPORT_SYMBOL(_write_lock_bh);
133#endif 133#endif
134 134
135#ifndef _spin_lock 135#ifndef CONFIG_INLINE_SPIN_LOCK
136void __lockfunc _spin_lock(spinlock_t *lock) 136void __lockfunc _spin_lock(spinlock_t *lock)
137{ 137{
138 __spin_lock(lock); 138 __spin_lock(lock);
@@ -140,7 +140,7 @@ void __lockfunc _spin_lock(spinlock_t *lock)
140EXPORT_SYMBOL(_spin_lock); 140EXPORT_SYMBOL(_spin_lock);
141#endif 141#endif
142 142
143#ifndef _write_lock 143#ifndef CONFIG_INLINE_WRITE_LOCK
144void __lockfunc _write_lock(rwlock_t *lock) 144void __lockfunc _write_lock(rwlock_t *lock)
145{ 145{
146 __write_lock(lock); 146 __write_lock(lock);
@@ -272,7 +272,7 @@ EXPORT_SYMBOL(_spin_lock_nest_lock);
272 272
273#endif 273#endif
274 274
275#ifndef _spin_unlock 275#ifndef CONFIG_INLINE_SPIN_UNLOCK
276void __lockfunc _spin_unlock(spinlock_t *lock) 276void __lockfunc _spin_unlock(spinlock_t *lock)
277{ 277{
278 __spin_unlock(lock); 278 __spin_unlock(lock);
@@ -280,7 +280,7 @@ void __lockfunc _spin_unlock(spinlock_t *lock)
280EXPORT_SYMBOL(_spin_unlock); 280EXPORT_SYMBOL(_spin_unlock);
281#endif 281#endif
282 282
283#ifndef _write_unlock 283#ifndef CONFIG_INLINE_WRITE_UNLOCK
284void __lockfunc _write_unlock(rwlock_t *lock) 284void __lockfunc _write_unlock(rwlock_t *lock)
285{ 285{
286 __write_unlock(lock); 286 __write_unlock(lock);
@@ -288,7 +288,7 @@ void __lockfunc _write_unlock(rwlock_t *lock)
288EXPORT_SYMBOL(_write_unlock); 288EXPORT_SYMBOL(_write_unlock);
289#endif 289#endif
290 290
291#ifndef _read_unlock 291#ifndef CONFIG_INLINE_READ_UNLOCK
292void __lockfunc _read_unlock(rwlock_t *lock) 292void __lockfunc _read_unlock(rwlock_t *lock)
293{ 293{
294 __read_unlock(lock); 294 __read_unlock(lock);
@@ -296,7 +296,7 @@ void __lockfunc _read_unlock(rwlock_t *lock)
296EXPORT_SYMBOL(_read_unlock); 296EXPORT_SYMBOL(_read_unlock);
297#endif 297#endif
298 298
299#ifndef _spin_unlock_irqrestore 299#ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE
300void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) 300void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
301{ 301{
302 __spin_unlock_irqrestore(lock, flags); 302 __spin_unlock_irqrestore(lock, flags);
@@ -304,7 +304,7 @@ void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
304EXPORT_SYMBOL(_spin_unlock_irqrestore); 304EXPORT_SYMBOL(_spin_unlock_irqrestore);
305#endif 305#endif
306 306
307#ifndef _spin_unlock_irq 307#ifndef CONFIG_INLINE_SPIN_UNLOCK_IRQ
308void __lockfunc _spin_unlock_irq(spinlock_t *lock) 308void __lockfunc _spin_unlock_irq(spinlock_t *lock)
309{ 309{
310 __spin_unlock_irq(lock); 310 __spin_unlock_irq(lock);
@@ -312,7 +312,7 @@ void __lockfunc _spin_unlock_irq(spinlock_t *lock)
312EXPORT_SYMBOL(_spin_unlock_irq); 312EXPORT_SYMBOL(_spin_unlock_irq);
313#endif 313#endif
314 314
315#ifndef _spin_unlock_bh 315#ifndef CONFIG_INLINE_SPIN_UNLOCK_BH
316void __lockfunc _spin_unlock_bh(spinlock_t *lock) 316void __lockfunc _spin_unlock_bh(spinlock_t *lock)
317{ 317{
318 __spin_unlock_bh(lock); 318 __spin_unlock_bh(lock);
@@ -320,7 +320,7 @@ void __lockfunc _spin_unlock_bh(spinlock_t *lock)
320EXPORT_SYMBOL(_spin_unlock_bh); 320EXPORT_SYMBOL(_spin_unlock_bh);
321#endif 321#endif
322 322
323#ifndef _read_unlock_irqrestore 323#ifndef CONFIG_INLINE_READ_UNLOCK_IRQRESTORE
324void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 324void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
325{ 325{
326 __read_unlock_irqrestore(lock, flags); 326 __read_unlock_irqrestore(lock, flags);
@@ -328,7 +328,7 @@ void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
328EXPORT_SYMBOL(_read_unlock_irqrestore); 328EXPORT_SYMBOL(_read_unlock_irqrestore);
329#endif 329#endif
330 330
331#ifndef _read_unlock_irq 331#ifndef CONFIG_INLINE_READ_UNLOCK_IRQ
332void __lockfunc _read_unlock_irq(rwlock_t *lock) 332void __lockfunc _read_unlock_irq(rwlock_t *lock)
333{ 333{
334 __read_unlock_irq(lock); 334 __read_unlock_irq(lock);
@@ -336,7 +336,7 @@ void __lockfunc _read_unlock_irq(rwlock_t *lock)
336EXPORT_SYMBOL(_read_unlock_irq); 336EXPORT_SYMBOL(_read_unlock_irq);
337#endif 337#endif
338 338
339#ifndef _read_unlock_bh 339#ifndef CONFIG_INLINE_READ_UNLOCK_BH
340void __lockfunc _read_unlock_bh(rwlock_t *lock) 340void __lockfunc _read_unlock_bh(rwlock_t *lock)
341{ 341{
342 __read_unlock_bh(lock); 342 __read_unlock_bh(lock);
@@ -344,7 +344,7 @@ void __lockfunc _read_unlock_bh(rwlock_t *lock)
344EXPORT_SYMBOL(_read_unlock_bh); 344EXPORT_SYMBOL(_read_unlock_bh);
345#endif 345#endif
346 346
347#ifndef _write_unlock_irqrestore 347#ifndef CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE
348void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags) 348void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
349{ 349{
350 __write_unlock_irqrestore(lock, flags); 350 __write_unlock_irqrestore(lock, flags);
@@ -352,7 +352,7 @@ void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
352EXPORT_SYMBOL(_write_unlock_irqrestore); 352EXPORT_SYMBOL(_write_unlock_irqrestore);
353#endif 353#endif
354 354
355#ifndef _write_unlock_irq 355#ifndef CONFIG_INLINE_WRITE_UNLOCK_IRQ
356void __lockfunc _write_unlock_irq(rwlock_t *lock) 356void __lockfunc _write_unlock_irq(rwlock_t *lock)
357{ 357{
358 __write_unlock_irq(lock); 358 __write_unlock_irq(lock);
@@ -360,7 +360,7 @@ void __lockfunc _write_unlock_irq(rwlock_t *lock)
360EXPORT_SYMBOL(_write_unlock_irq); 360EXPORT_SYMBOL(_write_unlock_irq);
361#endif 361#endif
362 362
363#ifndef _write_unlock_bh 363#ifndef CONFIG_INLINE_WRITE_UNLOCK_BH
364void __lockfunc _write_unlock_bh(rwlock_t *lock) 364void __lockfunc _write_unlock_bh(rwlock_t *lock)
365{ 365{
366 __write_unlock_bh(lock); 366 __write_unlock_bh(lock);
@@ -368,7 +368,7 @@ void __lockfunc _write_unlock_bh(rwlock_t *lock)
368EXPORT_SYMBOL(_write_unlock_bh); 368EXPORT_SYMBOL(_write_unlock_bh);
369#endif 369#endif
370 370
371#ifndef _spin_trylock_bh 371#ifndef CONFIG_INLINE_SPIN_TRYLOCK_BH
372int __lockfunc _spin_trylock_bh(spinlock_t *lock) 372int __lockfunc _spin_trylock_bh(spinlock_t *lock)
373{ 373{
374 return __spin_trylock_bh(lock); 374 return __spin_trylock_bh(lock);