aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rcupdate.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2009-08-22 16:56:47 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-23 04:32:37 -0400
commitbc33f24bdca8b6e97376e3a182ab69e6cdefa989 (patch)
tree86b56c35677fe19e6a2f39414526ece3625dcb32 /include/linux/rcupdate.h
parentd6714c22b43fbcbead7e7b706ff270e15f04a791 (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/linux/rcupdate.h')
-rw-r--r--include/linux/rcupdate.h46
1 files changed, 42 insertions, 4 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
84extern 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() 122static 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() 144static 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() 162static 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() 174static 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;
160static inline void rcu_read_lock_sched(void) 190static 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}
164static inline void rcu_read_lock_sched_notrace(void) 196static 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 */
174static inline void rcu_read_unlock_sched(void) 208static 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}
178static inline void rcu_read_unlock_sched_notrace(void) 214static 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