aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2017-03-15 16:07:53 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2017-04-18 14:38:21 -0400
commitefbe451d46af62369226e42b98dbcd95b6940a63 (patch)
treef3bad6628df15667a630bf4edf82de6ae29be6c3 /kernel
parent41f5c63178b7ca3d775638710b752b81b433fc86 (diff)
srcu: Move rcu_node traversal macros to rcu.h
This commit moves rcu_for_each_node_breadth_first(), rcu_for_each_nonleaf_node_breadth_first(), and rcu_for_each_leaf_node() from kernel/rcu/tree.h to kernel/rcu/rcu.h so that SRCU can access them. This commit is code-movement only. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rcu/rcu.h35
-rw-r--r--kernel/rcu/tree.h35
2 files changed, 35 insertions, 35 deletions
diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
index 87326479b39a..5c1798ec32f7 100644
--- a/kernel/rcu/rcu.h
+++ b/kernel/rcu/rcu.h
@@ -224,6 +224,41 @@ static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt)
224 } 224 }
225} 225}
226 226
227/*
228 * Do a full breadth-first scan of the rcu_node structures for the
229 * specified rcu_state structure.
230 */
231#define rcu_for_each_node_breadth_first(rsp, rnp) \
232 for ((rnp) = &(rsp)->node[0]; \
233 (rnp) < &(rsp)->node[rcu_num_nodes]; (rnp)++)
234
235/*
236 * Do a breadth-first scan of the non-leaf rcu_node structures for the
237 * specified rcu_state structure. Note that if there is a singleton
238 * rcu_node tree with but one rcu_node structure, this loop is a no-op.
239 */
240#define rcu_for_each_nonleaf_node_breadth_first(rsp, rnp) \
241 for ((rnp) = &(rsp)->node[0]; \
242 (rnp) < (rsp)->level[rcu_num_lvls - 1]; (rnp)++)
243
244/*
245 * Scan the leaves of the rcu_node hierarchy for the specified rcu_state
246 * structure. Note that if there is a singleton rcu_node tree with but
247 * one rcu_node structure, this loop -will- visit the rcu_node structure.
248 * It is still a leaf node, even if it is also the root node.
249 */
250#define rcu_for_each_leaf_node(rsp, rnp) \
251 for ((rnp) = (rsp)->level[rcu_num_lvls - 1]; \
252 (rnp) < &(rsp)->node[rcu_num_nodes]; (rnp)++)
253
254/*
255 * Iterate over all possible CPUs in a leaf RCU node.
256 */
257#define for_each_leaf_node_possible_cpu(rnp, cpu) \
258 for ((cpu) = cpumask_next(rnp->grplo - 1, cpu_possible_mask); \
259 cpu <= rnp->grphi; \
260 cpu = cpumask_next((cpu), cpu_possible_mask))
261
227#endif /* #if defined(SRCU) || !defined(TINY_RCU) */ 262#endif /* #if defined(SRCU) || !defined(TINY_RCU) */
228 263
229#endif /* __LINUX_RCU_H */ 264#endif /* __LINUX_RCU_H */
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 1bec3958d44f..a2a45cb629d6 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -193,41 +193,6 @@ struct rcu_node {
193#define leaf_node_cpu_bit(rnp, cpu) (1UL << ((cpu) - (rnp)->grplo)) 193#define leaf_node_cpu_bit(rnp, cpu) (1UL << ((cpu) - (rnp)->grplo))
194 194
195/* 195/*
196 * Do a full breadth-first scan of the rcu_node structures for the
197 * specified rcu_state structure.
198 */
199#define rcu_for_each_node_breadth_first(rsp, rnp) \
200 for ((rnp) = &(rsp)->node[0]; \
201 (rnp) < &(rsp)->node[rcu_num_nodes]; (rnp)++)
202
203/*
204 * Do a breadth-first scan of the non-leaf rcu_node structures for the
205 * specified rcu_state structure. Note that if there is a singleton
206 * rcu_node tree with but one rcu_node structure, this loop is a no-op.
207 */
208#define rcu_for_each_nonleaf_node_breadth_first(rsp, rnp) \
209 for ((rnp) = &(rsp)->node[0]; \
210 (rnp) < (rsp)->level[rcu_num_lvls - 1]; (rnp)++)
211
212/*
213 * Scan the leaves of the rcu_node hierarchy for the specified rcu_state
214 * structure. Note that if there is a singleton rcu_node tree with but
215 * one rcu_node structure, this loop -will- visit the rcu_node structure.
216 * It is still a leaf node, even if it is also the root node.
217 */
218#define rcu_for_each_leaf_node(rsp, rnp) \
219 for ((rnp) = (rsp)->level[rcu_num_lvls - 1]; \
220 (rnp) < &(rsp)->node[rcu_num_nodes]; (rnp)++)
221
222/*
223 * Iterate over all possible CPUs in a leaf RCU node.
224 */
225#define for_each_leaf_node_possible_cpu(rnp, cpu) \
226 for ((cpu) = cpumask_next(rnp->grplo - 1, cpu_possible_mask); \
227 cpu <= rnp->grphi; \
228 cpu = cpumask_next((cpu), cpu_possible_mask))
229
230/*
231 * Union to allow "aggregate OR" operation on the need for a quiescent 196 * Union to allow "aggregate OR" operation on the need for a quiescent
232 * state by the normal and expedited grace periods. 197 * state by the normal and expedited grace periods.
233 */ 198 */