diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-08-22 16:56:47 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-23 04:32:37 -0400 |
commit | bc33f24bdca8b6e97376e3a182ab69e6cdefa989 (patch) | |
tree | 86b56c35677fe19e6a2f39414526ece3625dcb32 /include | |
parent | d6714c22b43fbcbead7e7b706ff270e15f04a791 (diff) |
rcu: Consolidate sparse and lockdep declarations in include/linux/rcupdate.h
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: akpm@linux-foundation.org
Cc: mathieu.desnoyers@polymtl.ca
Cc: josht@linux.vnet.ibm.com
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
LKML-Reference: <12509746132349-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/rcupdate.h | 46 | ||||
-rw-r--r-- | include/linux/rcupreempt.h | 4 | ||||
-rw-r--r-- | include/linux/rcutree.h | 18 |
3 files changed, 44 insertions, 24 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index e920f0fd59d8..9d85ee19492a 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -80,6 +80,16 @@ extern int rcu_scheduler_active; | |||
80 | (ptr)->next = NULL; (ptr)->func = NULL; \ | 80 | (ptr)->next = NULL; (ptr)->func = NULL; \ |
81 | } while (0) | 81 | } while (0) |
82 | 82 | ||
83 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
84 | extern struct lockdep_map rcu_lock_map; | ||
85 | # define rcu_read_acquire() \ | ||
86 | lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) | ||
87 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) | ||
88 | #else | ||
89 | # define rcu_read_acquire() do { } while (0) | ||
90 | # define rcu_read_release() do { } while (0) | ||
91 | #endif | ||
92 | |||
83 | /** | 93 | /** |
84 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. | 94 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. |
85 | * | 95 | * |
@@ -109,7 +119,12 @@ extern int rcu_scheduler_active; | |||
109 | * | 119 | * |
110 | * It is illegal to block while in an RCU read-side critical section. | 120 | * It is illegal to block while in an RCU read-side critical section. |
111 | */ | 121 | */ |
112 | #define rcu_read_lock() __rcu_read_lock() | 122 | static inline void rcu_read_lock(void) |
123 | { | ||
124 | __rcu_read_lock(); | ||
125 | __acquire(RCU); | ||
126 | rcu_read_acquire(); | ||
127 | } | ||
113 | 128 | ||
114 | /** | 129 | /** |
115 | * rcu_read_unlock - marks the end of an RCU read-side critical section. | 130 | * rcu_read_unlock - marks the end of an RCU read-side critical section. |
@@ -126,7 +141,12 @@ extern int rcu_scheduler_active; | |||
126 | * used as well. RCU does not care how the writers keep out of each | 141 | * used as well. RCU does not care how the writers keep out of each |
127 | * others' way, as long as they do so. | 142 | * others' way, as long as they do so. |
128 | */ | 143 | */ |
129 | #define rcu_read_unlock() __rcu_read_unlock() | 144 | static inline void rcu_read_unlock(void) |
145 | { | ||
146 | rcu_read_release(); | ||
147 | __release(RCU); | ||
148 | __rcu_read_unlock(); | ||
149 | } | ||
130 | 150 | ||
131 | /** | 151 | /** |
132 | * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section | 152 | * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section |
@@ -139,14 +159,24 @@ extern int rcu_scheduler_active; | |||
139 | * can use just rcu_read_lock(). | 159 | * can use just rcu_read_lock(). |
140 | * | 160 | * |
141 | */ | 161 | */ |
142 | #define rcu_read_lock_bh() __rcu_read_lock_bh() | 162 | static inline void rcu_read_lock_bh(void) |
163 | { | ||
164 | __rcu_read_lock_bh(); | ||
165 | __acquire(RCU_BH); | ||
166 | rcu_read_acquire(); | ||
167 | } | ||
143 | 168 | ||
144 | /* | 169 | /* |
145 | * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section | 170 | * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section |
146 | * | 171 | * |
147 | * See rcu_read_lock_bh() for more information. | 172 | * See rcu_read_lock_bh() for more information. |
148 | */ | 173 | */ |
149 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() | 174 | static inline void rcu_read_unlock_bh(void) |
175 | { | ||
176 | rcu_read_release(); | ||
177 | __release(RCU_BH); | ||
178 | __rcu_read_unlock_bh(); | ||
179 | } | ||
150 | 180 | ||
151 | /** | 181 | /** |
152 | * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section | 182 | * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section |
@@ -160,10 +190,14 @@ extern int rcu_scheduler_active; | |||
160 | static inline void rcu_read_lock_sched(void) | 190 | static inline void rcu_read_lock_sched(void) |
161 | { | 191 | { |
162 | preempt_disable(); | 192 | preempt_disable(); |
193 | __acquire(RCU_SCHED); | ||
194 | rcu_read_acquire(); | ||
163 | } | 195 | } |
164 | static inline void rcu_read_lock_sched_notrace(void) | 196 | static inline void rcu_read_lock_sched_notrace(void) |
165 | { | 197 | { |
166 | preempt_disable_notrace(); | 198 | preempt_disable_notrace(); |
199 | __acquire(RCU_SCHED); | ||
200 | rcu_read_acquire(); | ||
167 | } | 201 | } |
168 | 202 | ||
169 | /* | 203 | /* |
@@ -173,10 +207,14 @@ static inline void rcu_read_lock_sched_notrace(void) | |||
173 | */ | 207 | */ |
174 | static inline void rcu_read_unlock_sched(void) | 208 | static inline void rcu_read_unlock_sched(void) |
175 | { | 209 | { |
210 | rcu_read_release(); | ||
211 | __release(RCU_SCHED); | ||
176 | preempt_enable(); | 212 | preempt_enable(); |
177 | } | 213 | } |
178 | static inline void rcu_read_unlock_sched_notrace(void) | 214 | static inline void rcu_read_unlock_sched_notrace(void) |
179 | { | 215 | { |
216 | rcu_read_release(); | ||
217 | __release(RCU_SCHED); | ||
180 | preempt_enable_notrace(); | 218 | preempt_enable_notrace(); |
181 | } | 219 | } |
182 | 220 | ||
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h index 2963f080e48d..6c9dd9cf8b8e 100644 --- a/include/linux/rcupreempt.h +++ b/include/linux/rcupreempt.h | |||
@@ -64,8 +64,8 @@ static inline void rcu_bh_qs(int cpu) { } | |||
64 | extern void call_rcu_sched(struct rcu_head *head, | 64 | extern void call_rcu_sched(struct rcu_head *head, |
65 | void (*func)(struct rcu_head *head)); | 65 | void (*func)(struct rcu_head *head)); |
66 | 66 | ||
67 | extern void __rcu_read_lock(void) __acquires(RCU); | 67 | extern void __rcu_read_lock(void); |
68 | extern void __rcu_read_unlock(void) __releases(RCU); | 68 | extern void __rcu_read_unlock(void); |
69 | extern int rcu_pending(int cpu); | 69 | extern int rcu_pending(int cpu); |
70 | extern int rcu_needs_cpu(int cpu); | 70 | extern int rcu_needs_cpu(int cpu); |
71 | 71 | ||
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index a0852d0d915b..8a0222ce3b13 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
@@ -36,38 +36,20 @@ extern void rcu_bh_qs(int cpu); | |||
36 | extern int rcu_pending(int cpu); | 36 | extern int rcu_pending(int cpu); |
37 | extern int rcu_needs_cpu(int cpu); | 37 | extern int rcu_needs_cpu(int cpu); |
38 | 38 | ||
39 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
40 | extern struct lockdep_map rcu_lock_map; | ||
41 | # define rcu_read_acquire() \ | ||
42 | lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) | ||
43 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) | ||
44 | #else | ||
45 | # define rcu_read_acquire() do { } while (0) | ||
46 | # define rcu_read_release() do { } while (0) | ||
47 | #endif | ||
48 | |||
49 | static inline void __rcu_read_lock(void) | 39 | static inline void __rcu_read_lock(void) |
50 | { | 40 | { |
51 | preempt_disable(); | 41 | preempt_disable(); |
52 | __acquire(RCU); | ||
53 | rcu_read_acquire(); | ||
54 | } | 42 | } |
55 | static inline void __rcu_read_unlock(void) | 43 | static inline void __rcu_read_unlock(void) |
56 | { | 44 | { |
57 | rcu_read_release(); | ||
58 | __release(RCU); | ||
59 | preempt_enable(); | 45 | preempt_enable(); |
60 | } | 46 | } |
61 | static inline void __rcu_read_lock_bh(void) | 47 | static inline void __rcu_read_lock_bh(void) |
62 | { | 48 | { |
63 | local_bh_disable(); | 49 | local_bh_disable(); |
64 | __acquire(RCU_BH); | ||
65 | rcu_read_acquire(); | ||
66 | } | 50 | } |
67 | static inline void __rcu_read_unlock_bh(void) | 51 | static inline void __rcu_read_unlock_bh(void) |
68 | { | 52 | { |
69 | rcu_read_release(); | ||
70 | __release(RCU_BH); | ||
71 | local_bh_enable(); | 53 | local_bh_enable(); |
72 | } | 54 | } |
73 | 55 | ||