diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:17:58 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:17:58 -0400 |
| commit | f262af3d08d3fffc4e11277d3a177b2d67ea2aba (patch) | |
| tree | cf5e4ac1bc39fe46cfbf4d17a0e9c71ee43b9728 /include/linux/rcupdate.h | |
| parent | 1014cfe2fb4cdd663137aafb21448cb613dd6a7d (diff) | |
| parent | 72d5a9f7a9542f88397558c65bcfc3b115a65e34 (diff) | |
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (24 commits)
rcu: remove all rcu head initializations, except on_stack initializations
rcu head introduce rcu head init on stack
Debugobjects transition check
rcu: fix build bug in RCU_FAST_NO_HZ builds
rcu: RCU_FAST_NO_HZ must check RCU dyntick state
rcu: make SRCU usable in modules
rcu: improve the RCU CPU-stall warning documentation
rcu: reduce the number of spurious RCU_SOFTIRQ invocations
rcu: permit discontiguous cpu_possible_mask CPU numbering
rcu: improve RCU CPU stall-warning messages
rcu: print boot-time console messages if RCU configs out of ordinary
rcu: disable CPU stall warnings upon panic
rcu: enable CPU_STALL_VERBOSE by default
rcu: slim down rcutiny by removing rcu_scheduler_active and friends
rcu: refactor RCU's context-switch handling
rcu: rename rcutiny rcu_ctrlblk to rcu_sched_ctrlblk
rcu: shrink rcutiny by making synchronize_rcu_bh() be inline
rcu: fix now-bogus rcu_scheduler_active comments.
rcu: Fix bogus CONFIG_PROVE_LOCKING in comments to reflect reality.
rcu: ignore offline CPUs in last non-dyntick-idle CPU check
...
Diffstat (limited to 'include/linux/rcupdate.h')
| -rw-r--r-- | include/linux/rcupdate.h | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index db266bbed23f..b653b4aaa8a6 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -56,8 +56,6 @@ struct rcu_head { | |||
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | /* Exported common interfaces */ | 58 | /* Exported common interfaces */ |
| 59 | extern void synchronize_rcu_bh(void); | ||
| 60 | extern void synchronize_sched(void); | ||
| 61 | extern void rcu_barrier(void); | 59 | extern void rcu_barrier(void); |
| 62 | extern void rcu_barrier_bh(void); | 60 | extern void rcu_barrier_bh(void); |
| 63 | extern void rcu_barrier_sched(void); | 61 | extern void rcu_barrier_sched(void); |
| @@ -66,8 +64,6 @@ extern int sched_expedited_torture_stats(char *page); | |||
| 66 | 64 | ||
| 67 | /* Internal to kernel */ | 65 | /* Internal to kernel */ |
| 68 | extern void rcu_init(void); | 66 | extern void rcu_init(void); |
| 69 | extern int rcu_scheduler_active; | ||
| 70 | extern void rcu_scheduler_starting(void); | ||
| 71 | 67 | ||
| 72 | #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) | 68 | #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) |
| 73 | #include <linux/rcutree.h> | 69 | #include <linux/rcutree.h> |
| @@ -83,6 +79,14 @@ extern void rcu_scheduler_starting(void); | |||
| 83 | (ptr)->next = NULL; (ptr)->func = NULL; \ | 79 | (ptr)->next = NULL; (ptr)->func = NULL; \ |
| 84 | } while (0) | 80 | } while (0) |
| 85 | 81 | ||
| 82 | static inline void init_rcu_head_on_stack(struct rcu_head *head) | ||
| 83 | { | ||
| 84 | } | ||
| 85 | |||
| 86 | static inline void destroy_rcu_head_on_stack(struct rcu_head *head) | ||
| 87 | { | ||
| 88 | } | ||
| 89 | |||
| 86 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 90 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
| 87 | 91 | ||
| 88 | extern struct lockdep_map rcu_lock_map; | 92 | extern struct lockdep_map rcu_lock_map; |
| @@ -106,12 +110,13 @@ extern int debug_lockdep_rcu_enabled(void); | |||
| 106 | /** | 110 | /** |
| 107 | * rcu_read_lock_held - might we be in RCU read-side critical section? | 111 | * rcu_read_lock_held - might we be in RCU read-side critical section? |
| 108 | * | 112 | * |
| 109 | * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in | 113 | * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU |
| 110 | * an RCU read-side critical section. In absence of CONFIG_PROVE_LOCKING, | 114 | * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC, |
| 111 | * this assumes we are in an RCU read-side critical section unless it can | 115 | * this assumes we are in an RCU read-side critical section unless it can |
| 112 | * prove otherwise. | 116 | * prove otherwise. |
| 113 | * | 117 | * |
| 114 | * Check rcu_scheduler_active to prevent false positives during boot. | 118 | * Check debug_lockdep_rcu_enabled() to prevent false positives during boot |
| 119 | * and while lockdep is disabled. | ||
| 115 | */ | 120 | */ |
| 116 | static inline int rcu_read_lock_held(void) | 121 | static inline int rcu_read_lock_held(void) |
| 117 | { | 122 | { |
| @@ -129,13 +134,15 @@ extern int rcu_read_lock_bh_held(void); | |||
| 129 | /** | 134 | /** |
| 130 | * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section? | 135 | * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section? |
| 131 | * | 136 | * |
| 132 | * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in an | 137 | * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an |
| 133 | * RCU-sched read-side critical section. In absence of CONFIG_PROVE_LOCKING, | 138 | * RCU-sched read-side critical section. In absence of |
| 134 | * this assumes we are in an RCU-sched read-side critical section unless it | 139 | * CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side |
| 135 | * can prove otherwise. Note that disabling of preemption (including | 140 | * critical section unless it can prove otherwise. Note that disabling |
| 136 | * disabling irqs) counts as an RCU-sched read-side critical section. | 141 | * of preemption (including disabling irqs) counts as an RCU-sched |
| 142 | * read-side critical section. | ||
| 137 | * | 143 | * |
| 138 | * Check rcu_scheduler_active to prevent false positives during boot. | 144 | * Check debug_lockdep_rcu_enabled() to prevent false positives during boot |
| 145 | * and while lockdep is disabled. | ||
| 139 | */ | 146 | */ |
| 140 | #ifdef CONFIG_PREEMPT | 147 | #ifdef CONFIG_PREEMPT |
| 141 | static inline int rcu_read_lock_sched_held(void) | 148 | static inline int rcu_read_lock_sched_held(void) |
| @@ -177,7 +184,7 @@ static inline int rcu_read_lock_bh_held(void) | |||
| 177 | #ifdef CONFIG_PREEMPT | 184 | #ifdef CONFIG_PREEMPT |
| 178 | static inline int rcu_read_lock_sched_held(void) | 185 | static inline int rcu_read_lock_sched_held(void) |
| 179 | { | 186 | { |
| 180 | return !rcu_scheduler_active || preempt_count() != 0 || irqs_disabled(); | 187 | return preempt_count() != 0 || irqs_disabled(); |
| 181 | } | 188 | } |
| 182 | #else /* #ifdef CONFIG_PREEMPT */ | 189 | #else /* #ifdef CONFIG_PREEMPT */ |
| 183 | static inline int rcu_read_lock_sched_held(void) | 190 | static inline int rcu_read_lock_sched_held(void) |
| @@ -192,6 +199,15 @@ static inline int rcu_read_lock_sched_held(void) | |||
| 192 | 199 | ||
| 193 | extern int rcu_my_thread_group_empty(void); | 200 | extern int rcu_my_thread_group_empty(void); |
| 194 | 201 | ||
| 202 | #define __do_rcu_dereference_check(c) \ | ||
| 203 | do { \ | ||
| 204 | static bool __warned; \ | ||
| 205 | if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \ | ||
| 206 | __warned = true; \ | ||
| 207 | lockdep_rcu_dereference(__FILE__, __LINE__); \ | ||
| 208 | } \ | ||
| 209 | } while (0) | ||
| 210 | |||
| 195 | /** | 211 | /** |
| 196 | * rcu_dereference_check - rcu_dereference with debug checking | 212 | * rcu_dereference_check - rcu_dereference with debug checking |
| 197 | * @p: The pointer to read, prior to dereferencing | 213 | * @p: The pointer to read, prior to dereferencing |
| @@ -221,8 +237,7 @@ extern int rcu_my_thread_group_empty(void); | |||
| 221 | */ | 237 | */ |
| 222 | #define rcu_dereference_check(p, c) \ | 238 | #define rcu_dereference_check(p, c) \ |
| 223 | ({ \ | 239 | ({ \ |
| 224 | if (debug_lockdep_rcu_enabled() && !(c)) \ | 240 | __do_rcu_dereference_check(c); \ |
| 225 | lockdep_rcu_dereference(__FILE__, __LINE__); \ | ||
| 226 | rcu_dereference_raw(p); \ | 241 | rcu_dereference_raw(p); \ |
| 227 | }) | 242 | }) |
| 228 | 243 | ||
| @@ -239,8 +254,7 @@ extern int rcu_my_thread_group_empty(void); | |||
| 239 | */ | 254 | */ |
| 240 | #define rcu_dereference_protected(p, c) \ | 255 | #define rcu_dereference_protected(p, c) \ |
| 241 | ({ \ | 256 | ({ \ |
| 242 | if (debug_lockdep_rcu_enabled() && !(c)) \ | 257 | __do_rcu_dereference_check(c); \ |
| 243 | lockdep_rcu_dereference(__FILE__, __LINE__); \ | ||
| 244 | (p); \ | 258 | (p); \ |
| 245 | }) | 259 | }) |
| 246 | 260 | ||
