diff options
Diffstat (limited to 'include/linux/rcupdate.h')
| -rw-r--r-- | include/linux/rcupdate.h | 98 |
1 files changed, 71 insertions, 27 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 15fbb3ca634d..95e0615f4d75 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -51,18 +51,26 @@ struct rcu_head { | |||
| 51 | void (*func)(struct rcu_head *head); | 51 | void (*func)(struct rcu_head *head); |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | /* Internal to kernel, but needed by rcupreempt.h. */ | 54 | /* Exported common interfaces */ |
| 55 | extern void synchronize_rcu(void); | ||
| 56 | extern void synchronize_rcu_bh(void); | ||
| 57 | extern void rcu_barrier(void); | ||
| 58 | extern void rcu_barrier_bh(void); | ||
| 59 | extern void rcu_barrier_sched(void); | ||
| 60 | extern void synchronize_sched_expedited(void); | ||
| 61 | extern int sched_expedited_torture_stats(char *page); | ||
| 62 | |||
| 63 | /* Internal to kernel */ | ||
| 64 | extern void rcu_init(void); | ||
| 65 | extern void rcu_scheduler_starting(void); | ||
| 66 | extern int rcu_needs_cpu(int cpu); | ||
| 55 | extern int rcu_scheduler_active; | 67 | extern int rcu_scheduler_active; |
| 56 | 68 | ||
| 57 | #if defined(CONFIG_CLASSIC_RCU) | 69 | #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) |
| 58 | #include <linux/rcuclassic.h> | ||
| 59 | #elif defined(CONFIG_TREE_RCU) | ||
| 60 | #include <linux/rcutree.h> | 70 | #include <linux/rcutree.h> |
| 61 | #elif defined(CONFIG_PREEMPT_RCU) | ||
| 62 | #include <linux/rcupreempt.h> | ||
| 63 | #else | 71 | #else |
| 64 | #error "Unknown RCU implementation specified to kernel configuration" | 72 | #error "Unknown RCU implementation specified to kernel configuration" |
| 65 | #endif /* #else #if defined(CONFIG_CLASSIC_RCU) */ | 73 | #endif |
| 66 | 74 | ||
| 67 | #define RCU_HEAD_INIT { .next = NULL, .func = NULL } | 75 | #define RCU_HEAD_INIT { .next = NULL, .func = NULL } |
| 68 | #define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT | 76 | #define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT |
| @@ -70,6 +78,16 @@ extern int rcu_scheduler_active; | |||
| 70 | (ptr)->next = NULL; (ptr)->func = NULL; \ | 78 | (ptr)->next = NULL; (ptr)->func = NULL; \ |
| 71 | } while (0) | 79 | } while (0) |
| 72 | 80 | ||
| 81 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
| 82 | extern struct lockdep_map rcu_lock_map; | ||
| 83 | # define rcu_read_acquire() \ | ||
| 84 | lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_) | ||
| 85 | # define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) | ||
| 86 | #else | ||
| 87 | # define rcu_read_acquire() do { } while (0) | ||
| 88 | # define rcu_read_release() do { } while (0) | ||
| 89 | #endif | ||
| 90 | |||
| 73 | /** | 91 | /** |
| 74 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. | 92 | * rcu_read_lock - mark the beginning of an RCU read-side critical section. |
| 75 | * | 93 | * |
| @@ -99,7 +117,12 @@ extern int rcu_scheduler_active; | |||
| 99 | * | 117 | * |
| 100 | * It is illegal to block while in an RCU read-side critical section. | 118 | * It is illegal to block while in an RCU read-side critical section. |
| 101 | */ | 119 | */ |
| 102 | #define rcu_read_lock() __rcu_read_lock() | 120 | static inline void rcu_read_lock(void) |
| 121 | { | ||
| 122 | __rcu_read_lock(); | ||
| 123 | __acquire(RCU); | ||
| 124 | rcu_read_acquire(); | ||
| 125 | } | ||
| 103 | 126 | ||
| 104 | /** | 127 | /** |
| 105 | * rcu_read_unlock - marks the end of an RCU read-side critical section. | 128 | * rcu_read_unlock - marks the end of an RCU read-side critical section. |
| @@ -116,7 +139,12 @@ extern int rcu_scheduler_active; | |||
| 116 | * used as well. RCU does not care how the writers keep out of each | 139 | * used as well. RCU does not care how the writers keep out of each |
| 117 | * others' way, as long as they do so. | 140 | * others' way, as long as they do so. |
| 118 | */ | 141 | */ |
| 119 | #define rcu_read_unlock() __rcu_read_unlock() | 142 | static inline void rcu_read_unlock(void) |
| 143 | { | ||
| 144 | rcu_read_release(); | ||
| 145 | __release(RCU); | ||
| 146 | __rcu_read_unlock(); | ||
| 147 | } | ||
| 120 | 148 | ||
| 121 | /** | 149 | /** |
| 122 | * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section | 150 | * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section |
| @@ -129,14 +157,24 @@ extern int rcu_scheduler_active; | |||
| 129 | * can use just rcu_read_lock(). | 157 | * can use just rcu_read_lock(). |
| 130 | * | 158 | * |
| 131 | */ | 159 | */ |
| 132 | #define rcu_read_lock_bh() __rcu_read_lock_bh() | 160 | static inline void rcu_read_lock_bh(void) |
| 161 | { | ||
| 162 | __rcu_read_lock_bh(); | ||
| 163 | __acquire(RCU_BH); | ||
| 164 | rcu_read_acquire(); | ||
| 165 | } | ||
| 133 | 166 | ||
| 134 | /* | 167 | /* |
| 135 | * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section | 168 | * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section |
| 136 | * | 169 | * |
| 137 | * See rcu_read_lock_bh() for more information. | 170 | * See rcu_read_lock_bh() for more information. |
| 138 | */ | 171 | */ |
| 139 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() | 172 | static inline void rcu_read_unlock_bh(void) |
| 173 | { | ||
| 174 | rcu_read_release(); | ||
| 175 | __release(RCU_BH); | ||
| 176 | __rcu_read_unlock_bh(); | ||
| 177 | } | ||
| 140 | 178 | ||
| 141 | /** | 179 | /** |
| 142 | * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section | 180 | * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section |
| @@ -147,17 +185,34 @@ extern int rcu_scheduler_active; | |||
| 147 | * - call_rcu_sched() and rcu_barrier_sched() | 185 | * - call_rcu_sched() and rcu_barrier_sched() |
| 148 | * on the write-side to insure proper synchronization. | 186 | * on the write-side to insure proper synchronization. |
| 149 | */ | 187 | */ |
| 150 | #define rcu_read_lock_sched() preempt_disable() | 188 | static inline void rcu_read_lock_sched(void) |
| 151 | #define rcu_read_lock_sched_notrace() preempt_disable_notrace() | 189 | { |
| 190 | preempt_disable(); | ||
| 191 | __acquire(RCU_SCHED); | ||
| 192 | rcu_read_acquire(); | ||
| 193 | } | ||
| 194 | static inline notrace void rcu_read_lock_sched_notrace(void) | ||
| 195 | { | ||
| 196 | preempt_disable_notrace(); | ||
| 197 | __acquire(RCU_SCHED); | ||
| 198 | } | ||
| 152 | 199 | ||
| 153 | /* | 200 | /* |
| 154 | * rcu_read_unlock_sched - marks the end of a RCU-classic critical section | 201 | * rcu_read_unlock_sched - marks the end of a RCU-classic critical section |
| 155 | * | 202 | * |
| 156 | * See rcu_read_lock_sched for more information. | 203 | * See rcu_read_lock_sched for more information. |
| 157 | */ | 204 | */ |
| 158 | #define rcu_read_unlock_sched() preempt_enable() | 205 | static inline void rcu_read_unlock_sched(void) |
| 159 | #define rcu_read_unlock_sched_notrace() preempt_enable_notrace() | 206 | { |
| 160 | 207 | rcu_read_release(); | |
| 208 | __release(RCU_SCHED); | ||
| 209 | preempt_enable(); | ||
| 210 | } | ||
| 211 | static inline notrace void rcu_read_unlock_sched_notrace(void) | ||
| 212 | { | ||
| 213 | __release(RCU_SCHED); | ||
| 214 | preempt_enable_notrace(); | ||
| 215 | } | ||
| 161 | 216 | ||
| 162 | 217 | ||
| 163 | /** | 218 | /** |
| @@ -259,15 +314,4 @@ extern void call_rcu(struct rcu_head *head, | |||
| 259 | extern void call_rcu_bh(struct rcu_head *head, | 314 | extern void call_rcu_bh(struct rcu_head *head, |
| 260 | void (*func)(struct rcu_head *head)); | 315 | void (*func)(struct rcu_head *head)); |
| 261 | 316 | ||
| 262 | /* Exported common interfaces */ | ||
| 263 | extern void synchronize_rcu(void); | ||
| 264 | extern void rcu_barrier(void); | ||
| 265 | extern void rcu_barrier_bh(void); | ||
| 266 | extern void rcu_barrier_sched(void); | ||
| 267 | |||
| 268 | /* Internal to kernel */ | ||
| 269 | extern void rcu_init(void); | ||
| 270 | extern void rcu_scheduler_starting(void); | ||
| 271 | extern int rcu_needs_cpu(int cpu); | ||
| 272 | |||
| 273 | #endif /* __LINUX_RCUPDATE_H */ | 317 | #endif /* __LINUX_RCUPDATE_H */ |
