aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcutree.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2009-09-23 12:50:42 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-23 13:46:29 -0400
commit1eba8f84380bede3c602bd7758dea96925cead01 (patch)
tree32dd97671016c9fdc24d75be50cc8540e6cc0730 /kernel/rcutree.h
parentfc2219d49ef1606e7fd2c88af2b423b01ff3d319 (diff)
rcu: Clean up code based on review feedback from Josh Triplett, part 2
These issues identified during an old-fashioned face-to-face code review extending over many hours. o Add comments for tricky parts of code, and correct comments that have passed their sell-by date. o Get rid of the vestiges of rcu_init_sched(), which is no longer needed now that PREEMPT_RCU is gone. o Move the #include of rcutree_plugin.h to the end of rcutree.c, which means that, rather than having a random collection of forward declarations, the new set of forward declarations document the set of plugins. The new home for this #include also allows __rcu_init_preempt() to move into rcutree_plugin.h. o Fix rcu_preempt_check_callbacks() to be static. Suggested-by: Josh Triplett <josh@joshtriplett.org> 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: josh@joshtriplett.org Cc: dvhltc@us.ibm.com Cc: niv@us.ibm.com Cc: peterz@infradead.org Cc: rostedt@goodmis.org Cc: Valdis.Kletnieks@vt.edu Cc: dhowells@redhat.com LKML-Reference: <12537246443924-git-send-email-> Signed-off-by: Ingo Molnar <mingo@elte.hu> Peter Zijlstra <peterz@infradead.org>
Diffstat (limited to 'kernel/rcutree.h')
-rw-r--r--kernel/rcutree.h31
1 files changed, 23 insertions, 8 deletions
diff --git a/kernel/rcutree.h b/kernel/rcutree.h
index 9aa8c8a160d8..a48d11f37b4c 100644
--- a/kernel/rcutree.h
+++ b/kernel/rcutree.h
@@ -79,15 +79,21 @@ struct rcu_dynticks {
79 * Definition for node within the RCU grace-period-detection hierarchy. 79 * Definition for node within the RCU grace-period-detection hierarchy.
80 */ 80 */
81struct rcu_node { 81struct rcu_node {
82 spinlock_t lock; 82 spinlock_t lock; /* Root rcu_node's lock protects some */
83 /* rcu_state fields as well as following. */
83 long gpnum; /* Current grace period for this node. */ 84 long gpnum; /* Current grace period for this node. */
84 /* This will either be equal to or one */ 85 /* This will either be equal to or one */
85 /* behind the root rcu_node's gpnum. */ 86 /* behind the root rcu_node's gpnum. */
86 unsigned long qsmask; /* CPUs or groups that need to switch in */ 87 unsigned long qsmask; /* CPUs or groups that need to switch in */
87 /* order for current grace period to proceed.*/ 88 /* order for current grace period to proceed.*/
89 /* In leaf rcu_node, each bit corresponds to */
90 /* an rcu_data structure, otherwise, each */
91 /* bit corresponds to a child rcu_node */
92 /* structure. */
88 unsigned long qsmaskinit; 93 unsigned long qsmaskinit;
89 /* Per-GP initialization for qsmask. */ 94 /* Per-GP initialization for qsmask. */
90 unsigned long grpmask; /* Mask to apply to parent qsmask. */ 95 unsigned long grpmask; /* Mask to apply to parent qsmask. */
96 /* Only one bit will be set in this mask. */
91 int grplo; /* lowest-numbered CPU or group here. */ 97 int grplo; /* lowest-numbered CPU or group here. */
92 int grphi; /* highest-numbered CPU or group here. */ 98 int grphi; /* highest-numbered CPU or group here. */
93 u8 grpnum; /* CPU/group number for next level up. */ 99 u8 grpnum; /* CPU/group number for next level up. */
@@ -95,6 +101,9 @@ struct rcu_node {
95 struct rcu_node *parent; 101 struct rcu_node *parent;
96 struct list_head blocked_tasks[2]; 102 struct list_head blocked_tasks[2];
97 /* Tasks blocked in RCU read-side critsect. */ 103 /* Tasks blocked in RCU read-side critsect. */
104 /* Grace period number (->gpnum) x blocked */
105 /* by tasks on the (x & 0x1) element of the */
106 /* blocked_tasks[] array. */
98} ____cacheline_internodealigned_in_smp; 107} ____cacheline_internodealigned_in_smp;
99 108
100/* Index values for nxttail array in struct rcu_data. */ 109/* Index values for nxttail array in struct rcu_data. */
@@ -126,19 +135,22 @@ struct rcu_data {
126 * Any of the partitions might be empty, in which case the 135 * Any of the partitions might be empty, in which case the
127 * pointer to that partition will be equal to the pointer for 136 * pointer to that partition will be equal to the pointer for
128 * the following partition. When the list is empty, all of 137 * the following partition. When the list is empty, all of
129 * the nxttail elements point to nxtlist, which is NULL. 138 * the nxttail elements point to the ->nxtlist pointer itself,
139 * which in that case is NULL.
130 * 140 *
131 * [*nxttail[RCU_NEXT_READY_TAIL], NULL = *nxttail[RCU_NEXT_TAIL]):
132 * Entries that might have arrived after current GP ended
133 * [*nxttail[RCU_WAIT_TAIL], *nxttail[RCU_NEXT_READY_TAIL]):
134 * Entries known to have arrived before current GP ended
135 * [*nxttail[RCU_DONE_TAIL], *nxttail[RCU_WAIT_TAIL]):
136 * Entries that batch # <= ->completed - 1: waiting for current GP
137 * [nxtlist, *nxttail[RCU_DONE_TAIL]): 141 * [nxtlist, *nxttail[RCU_DONE_TAIL]):
138 * Entries that batch # <= ->completed 142 * Entries that batch # <= ->completed
139 * The grace period for these entries has completed, and 143 * The grace period for these entries has completed, and
140 * the other grace-period-completed entries may be moved 144 * the other grace-period-completed entries may be moved
141 * here temporarily in rcu_process_callbacks(). 145 * here temporarily in rcu_process_callbacks().
146 * [*nxttail[RCU_DONE_TAIL], *nxttail[RCU_WAIT_TAIL]):
147 * Entries that batch # <= ->completed - 1: waiting for current GP
148 * [*nxttail[RCU_WAIT_TAIL], *nxttail[RCU_NEXT_READY_TAIL]):
149 * Entries known to have arrived before current GP ended
150 * [*nxttail[RCU_NEXT_READY_TAIL], *nxttail[RCU_NEXT_TAIL]):
151 * Entries that might have arrived after current GP ended
152 * Note that the value of *nxttail[RCU_NEXT_TAIL] will
153 * always be NULL, as this is the end of the list.
142 */ 154 */
143 struct rcu_head *nxtlist; 155 struct rcu_head *nxtlist;
144 struct rcu_head **nxttail[RCU_NEXT_SIZE]; 156 struct rcu_head **nxttail[RCU_NEXT_SIZE];
@@ -216,6 +228,9 @@ struct rcu_state {
216 /* Force QS state. */ 228 /* Force QS state. */
217 long gpnum; /* Current gp number. */ 229 long gpnum; /* Current gp number. */
218 long completed; /* # of last completed gp. */ 230 long completed; /* # of last completed gp. */
231
232 /* End of fields guarded by root rcu_node's lock. */
233
219 spinlock_t onofflock; /* exclude on/offline and */ 234 spinlock_t onofflock; /* exclude on/offline and */
220 /* starting new GP. */ 235 /* starting new GP. */
221 spinlock_t fqslock; /* Only one task forcing */ 236 spinlock_t fqslock; /* Only one task forcing */