diff options
Diffstat (limited to 'kernel/rcutree.h')
-rw-r--r-- | kernel/rcutree.h | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/kernel/rcutree.h b/kernel/rcutree.h index d2a0046f63b2..1439eb504c22 100644 --- a/kernel/rcutree.h +++ b/kernel/rcutree.h | |||
@@ -90,12 +90,12 @@ struct rcu_dynticks { | |||
90 | * Definition for node within the RCU grace-period-detection hierarchy. | 90 | * Definition for node within the RCU grace-period-detection hierarchy. |
91 | */ | 91 | */ |
92 | struct rcu_node { | 92 | struct rcu_node { |
93 | spinlock_t lock; /* Root rcu_node's lock protects some */ | 93 | raw_spinlock_t lock; /* Root rcu_node's lock protects some */ |
94 | /* rcu_state fields as well as following. */ | 94 | /* rcu_state fields as well as following. */ |
95 | long gpnum; /* Current grace period for this node. */ | 95 | unsigned long gpnum; /* Current grace period for this node. */ |
96 | /* This will either be equal to or one */ | 96 | /* This will either be equal to or one */ |
97 | /* behind the root rcu_node's gpnum. */ | 97 | /* behind the root rcu_node's gpnum. */ |
98 | long completed; /* Last grace period completed for this node. */ | 98 | unsigned long completed; /* Last GP completed for this node. */ |
99 | /* This will either be equal to or one */ | 99 | /* This will either be equal to or one */ |
100 | /* behind the root rcu_node's gpnum. */ | 100 | /* behind the root rcu_node's gpnum. */ |
101 | unsigned long qsmask; /* CPUs or groups that need to switch in */ | 101 | unsigned long qsmask; /* CPUs or groups that need to switch in */ |
@@ -161,11 +161,11 @@ struct rcu_node { | |||
161 | /* Per-CPU data for read-copy update. */ | 161 | /* Per-CPU data for read-copy update. */ |
162 | struct rcu_data { | 162 | struct rcu_data { |
163 | /* 1) quiescent-state and grace-period handling : */ | 163 | /* 1) quiescent-state and grace-period handling : */ |
164 | long completed; /* Track rsp->completed gp number */ | 164 | unsigned long completed; /* Track rsp->completed gp number */ |
165 | /* in order to detect GP end. */ | 165 | /* in order to detect GP end. */ |
166 | long gpnum; /* Highest gp number that this CPU */ | 166 | unsigned long gpnum; /* Highest gp number that this CPU */ |
167 | /* is aware of having started. */ | 167 | /* is aware of having started. */ |
168 | long passed_quiesc_completed; | 168 | unsigned long passed_quiesc_completed; |
169 | /* Value of completed at time of qs. */ | 169 | /* Value of completed at time of qs. */ |
170 | bool passed_quiesc; /* User-mode/idle loop etc. */ | 170 | bool passed_quiesc; /* User-mode/idle loop etc. */ |
171 | bool qs_pending; /* Core waits for quiesc state. */ | 171 | bool qs_pending; /* Core waits for quiesc state. */ |
@@ -221,14 +221,14 @@ struct rcu_data { | |||
221 | unsigned long resched_ipi; /* Sent a resched IPI. */ | 221 | unsigned long resched_ipi; /* Sent a resched IPI. */ |
222 | 222 | ||
223 | /* 5) __rcu_pending() statistics. */ | 223 | /* 5) __rcu_pending() statistics. */ |
224 | long n_rcu_pending; /* rcu_pending() calls since boot. */ | 224 | unsigned long n_rcu_pending; /* rcu_pending() calls since boot. */ |
225 | long n_rp_qs_pending; | 225 | unsigned long n_rp_qs_pending; |
226 | long n_rp_cb_ready; | 226 | unsigned long n_rp_cb_ready; |
227 | long n_rp_cpu_needs_gp; | 227 | unsigned long n_rp_cpu_needs_gp; |
228 | long n_rp_gp_completed; | 228 | unsigned long n_rp_gp_completed; |
229 | long n_rp_gp_started; | 229 | unsigned long n_rp_gp_started; |
230 | long n_rp_need_fqs; | 230 | unsigned long n_rp_need_fqs; |
231 | long n_rp_need_nothing; | 231 | unsigned long n_rp_need_nothing; |
232 | 232 | ||
233 | int cpu; | 233 | int cpu; |
234 | }; | 234 | }; |
@@ -237,12 +237,11 @@ struct rcu_data { | |||
237 | #define RCU_GP_IDLE 0 /* No grace period in progress. */ | 237 | #define RCU_GP_IDLE 0 /* No grace period in progress. */ |
238 | #define RCU_GP_INIT 1 /* Grace period being initialized. */ | 238 | #define RCU_GP_INIT 1 /* Grace period being initialized. */ |
239 | #define RCU_SAVE_DYNTICK 2 /* Need to scan dyntick state. */ | 239 | #define RCU_SAVE_DYNTICK 2 /* Need to scan dyntick state. */ |
240 | #define RCU_SAVE_COMPLETED 3 /* Need to save rsp->completed. */ | 240 | #define RCU_FORCE_QS 3 /* Need to force quiescent state. */ |
241 | #define RCU_FORCE_QS 4 /* Need to force quiescent state. */ | ||
242 | #ifdef CONFIG_NO_HZ | 241 | #ifdef CONFIG_NO_HZ |
243 | #define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK | 242 | #define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK |
244 | #else /* #ifdef CONFIG_NO_HZ */ | 243 | #else /* #ifdef CONFIG_NO_HZ */ |
245 | #define RCU_SIGNAL_INIT RCU_SAVE_COMPLETED | 244 | #define RCU_SIGNAL_INIT RCU_FORCE_QS |
246 | #endif /* #else #ifdef CONFIG_NO_HZ */ | 245 | #endif /* #else #ifdef CONFIG_NO_HZ */ |
247 | 246 | ||
248 | #define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */ | 247 | #define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */ |
@@ -256,6 +255,9 @@ struct rcu_data { | |||
256 | 255 | ||
257 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | 256 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ |
258 | 257 | ||
258 | #define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b)) | ||
259 | #define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b)) | ||
260 | |||
259 | /* | 261 | /* |
260 | * RCU global state, including node hierarchy. This hierarchy is | 262 | * RCU global state, including node hierarchy. This hierarchy is |
261 | * represented in "heap" form in a dense array. The root (first level) | 263 | * represented in "heap" form in a dense array. The root (first level) |
@@ -277,12 +279,19 @@ struct rcu_state { | |||
277 | 279 | ||
278 | u8 signaled ____cacheline_internodealigned_in_smp; | 280 | u8 signaled ____cacheline_internodealigned_in_smp; |
279 | /* Force QS state. */ | 281 | /* Force QS state. */ |
280 | long gpnum; /* Current gp number. */ | 282 | u8 fqs_active; /* force_quiescent_state() */ |
281 | long completed; /* # of last completed gp. */ | 283 | /* is running. */ |
284 | u8 fqs_need_gp; /* A CPU was prevented from */ | ||
285 | /* starting a new grace */ | ||
286 | /* period because */ | ||
287 | /* force_quiescent_state() */ | ||
288 | /* was running. */ | ||
289 | unsigned long gpnum; /* Current gp number. */ | ||
290 | unsigned long completed; /* # of last completed gp. */ | ||
282 | 291 | ||
283 | /* End of fields guarded by root rcu_node's lock. */ | 292 | /* End of fields guarded by root rcu_node's lock. */ |
284 | 293 | ||
285 | spinlock_t onofflock; /* exclude on/offline and */ | 294 | raw_spinlock_t onofflock; /* exclude on/offline and */ |
286 | /* starting new GP. Also */ | 295 | /* starting new GP. Also */ |
287 | /* protects the following */ | 296 | /* protects the following */ |
288 | /* orphan_cbs fields. */ | 297 | /* orphan_cbs fields. */ |
@@ -292,10 +301,8 @@ struct rcu_state { | |||
292 | /* going offline. */ | 301 | /* going offline. */ |
293 | struct rcu_head **orphan_cbs_tail; /* And tail pointer. */ | 302 | struct rcu_head **orphan_cbs_tail; /* And tail pointer. */ |
294 | long orphan_qlen; /* Number of orphaned cbs. */ | 303 | long orphan_qlen; /* Number of orphaned cbs. */ |
295 | spinlock_t fqslock; /* Only one task forcing */ | 304 | raw_spinlock_t fqslock; /* Only one task forcing */ |
296 | /* quiescent states. */ | 305 | /* quiescent states. */ |
297 | long completed_fqs; /* Value of completed @ snap. */ | ||
298 | /* Protected by fqslock. */ | ||
299 | unsigned long jiffies_force_qs; /* Time at which to invoke */ | 306 | unsigned long jiffies_force_qs; /* Time at which to invoke */ |
300 | /* force_quiescent_state(). */ | 307 | /* force_quiescent_state(). */ |
301 | unsigned long n_force_qs; /* Number of calls to */ | 308 | unsigned long n_force_qs; /* Number of calls to */ |
@@ -319,8 +326,6 @@ struct rcu_state { | |||
319 | #define RCU_OFL_TASKS_EXP_GP 0x2 /* Tasks blocking expedited */ | 326 | #define RCU_OFL_TASKS_EXP_GP 0x2 /* Tasks blocking expedited */ |
320 | /* GP were moved to root. */ | 327 | /* GP were moved to root. */ |
321 | 328 | ||
322 | #ifdef RCU_TREE_NONCORE | ||
323 | |||
324 | /* | 329 | /* |
325 | * RCU implementation internal declarations: | 330 | * RCU implementation internal declarations: |
326 | */ | 331 | */ |
@@ -335,7 +340,7 @@ extern struct rcu_state rcu_preempt_state; | |||
335 | DECLARE_PER_CPU(struct rcu_data, rcu_preempt_data); | 340 | DECLARE_PER_CPU(struct rcu_data, rcu_preempt_data); |
336 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 341 | #endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
337 | 342 | ||
338 | #else /* #ifdef RCU_TREE_NONCORE */ | 343 | #ifndef RCU_TREE_NONCORE |
339 | 344 | ||
340 | /* Forward declarations for rcutree_plugin.h */ | 345 | /* Forward declarations for rcutree_plugin.h */ |
341 | static void rcu_bootup_announce(void); | 346 | static void rcu_bootup_announce(void); |
@@ -347,6 +352,7 @@ static void rcu_report_unblock_qs_rnp(struct rcu_node *rnp, | |||
347 | unsigned long flags); | 352 | unsigned long flags); |
348 | #endif /* #ifdef CONFIG_HOTPLUG_CPU */ | 353 | #endif /* #ifdef CONFIG_HOTPLUG_CPU */ |
349 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | 354 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR |
355 | static void rcu_print_detail_task_stall(struct rcu_state *rsp); | ||
350 | static void rcu_print_task_stall(struct rcu_node *rnp); | 356 | static void rcu_print_task_stall(struct rcu_node *rnp); |
351 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | 357 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ |
352 | static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp); | 358 | static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp); |
@@ -367,5 +373,6 @@ static int rcu_preempt_needs_cpu(int cpu); | |||
367 | static void __cpuinit rcu_preempt_init_percpu_data(int cpu); | 373 | static void __cpuinit rcu_preempt_init_percpu_data(int cpu); |
368 | static void rcu_preempt_send_cbs_to_orphanage(void); | 374 | static void rcu_preempt_send_cbs_to_orphanage(void); |
369 | static void __init __rcu_init_preempt(void); | 375 | static void __init __rcu_init_preempt(void); |
376 | static void rcu_needs_cpu_flush(void); | ||
370 | 377 | ||
371 | #endif /* #else #ifdef RCU_TREE_NONCORE */ | 378 | #endif /* #ifndef RCU_TREE_NONCORE */ |