aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcutree.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2009-08-22 16:56:52 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-23 04:32:40 -0400
commitf41d911f8c49a5d65c86504c19e8204bb605c4fd (patch)
tree59bcd3048652ef290b3e19d2904409afd5c90eb3 /kernel/rcutree.h
parenta157229cabd6dd8cfa82525fc9bf730c94cc9ac2 (diff)
rcu: Merge preemptable-RCU functionality into hierarchical RCU
Create a kernel/rcutree_plugin.h file that contains definitions for preemptable RCU (or, under the #else branch of the #ifdef, empty definitions for the classic non-preemptable semantics). These definitions fit into plugins defined in kernel/rcutree.c for this purpose. This variant of preemptable RCU uses a new algorithm whose read-side expense is roughly that of classic hierarchical RCU under CONFIG_PREEMPT. This new algorithm's update-side expense is similar to that of classic hierarchical RCU, and, in absence of read-side preemption or blocking, is exactly that of classic hierarchical RCU. Perhaps more important, this new algorithm has a much simpler implementation, saving well over 1,000 lines of code compared to mainline's implementation of preemptable RCU, which will hopefully be retired in favor of this new algorithm. The simplifications are obtained by maintaining per-task nesting state for running tasks, and using a simple lock-protected algorithm to handle accounting when tasks block within RCU read-side critical sections, making use of lessons learned while creating numerous user-level RCU implementations over the past 18 months. 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: <12509746134003-git-send-email-> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutree.h')
-rw-r--r--kernel/rcutree.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index 0024e5ddcc68..ca560364d8cd 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -80,6 +80,7 @@ struct rcu_dynticks {
80 */ 80 */
81struct rcu_node { 81struct rcu_node {
82 spinlock_t lock; 82 spinlock_t lock;
83 long gpnum; /* Current grace period for this node. */
83 unsigned long qsmask; /* CPUs or groups that need to switch in */ 84 unsigned long qsmask; /* CPUs or groups that need to switch in */
84 /* order for current grace period to proceed.*/ 85 /* order for current grace period to proceed.*/
85 unsigned long qsmaskinit; 86 unsigned long qsmaskinit;
@@ -90,6 +91,8 @@ struct rcu_node {
90 u8 grpnum; /* CPU/group number for next level up. */ 91 u8 grpnum; /* CPU/group number for next level up. */
91 u8 level; /* root is at level 0. */ 92 u8 level; /* root is at level 0. */
92 struct rcu_node *parent; 93 struct rcu_node *parent;
94 struct list_head blocked_tasks[2];
95 /* Tasks blocked in RCU read-side critsect. */
93} ____cacheline_internodealigned_in_smp; 96} ____cacheline_internodealigned_in_smp;
94 97
95/* Index values for nxttail array in struct rcu_data. */ 98/* Index values for nxttail array in struct rcu_data. */
@@ -111,6 +114,7 @@ struct rcu_data {
111 bool passed_quiesc; /* User-mode/idle loop etc. */ 114 bool passed_quiesc; /* User-mode/idle loop etc. */
112 bool qs_pending; /* Core waits for quiesc state. */ 115 bool qs_pending; /* Core waits for quiesc state. */
113 bool beenonline; /* CPU online at least once. */ 116 bool beenonline; /* CPU online at least once. */
117 bool preemptable; /* Preemptable RCU? */
114 struct rcu_node *mynode; /* This CPU's leaf of hierarchy */ 118 struct rcu_node *mynode; /* This CPU's leaf of hierarchy */
115 unsigned long grpmask; /* Mask to apply to leaf qsmask. */ 119 unsigned long grpmask; /* Mask to apply to leaf qsmask. */
116 120
@@ -244,5 +248,10 @@ DECLARE_PER_CPU(struct rcu_data, rcu_sched_data);
244extern struct rcu_state rcu_bh_state; 248extern struct rcu_state rcu_bh_state;
245DECLARE_PER_CPU(struct rcu_data, rcu_bh_data); 249DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
246 250
251#ifdef CONFIG_TREE_PREEMPT_RCU
252extern struct rcu_state rcu_preempt_state;
253DECLARE_PER_CPU(struct rcu_data, rcu_preempt_data);
254#endif /* #ifdef CONFIG_TREE_PREEMPT_RCU */
255
247#endif /* #ifdef RCU_TREE_NONCORE */ 256#endif /* #ifdef RCU_TREE_NONCORE */
248 257