aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu/tree.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-04-20 14:40:50 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-05-27 15:59:04 -0400
commita3dc2948cec80f20a89e9b646d0c01b121e48e02 (patch)
tree194400d72447cb60c050a7a572dc00f214934f43 /kernel/rcu/tree.c
parent7fa270010e0ddd3693381431f373b3e3135b0695 (diff)
rcu: Enable diagnostic dump of rcu_node combining tree
The purpose of this commit is to make it easier to verify that RCU's combining tree is set up correctly, which is useful to have when making changes in how that tree is initialized. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Pranith Kumar <bobby.prani@gmail.com> [ paulmck: Fold fix found by Fengguang's 0-day test robot. ]
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r--kernel/rcu/tree.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index b49c474e1fff..1bc14c670641 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -113,6 +113,9 @@ RCU_STATE_INITIALIZER(rcu_bh, 'b', call_rcu_bh);
113static struct rcu_state *rcu_state_p; 113static struct rcu_state *rcu_state_p;
114LIST_HEAD(rcu_struct_flavors); 114LIST_HEAD(rcu_struct_flavors);
115 115
116/* Dump rcu_node combining tree at boot to verify correct setup. */
117static bool dump_tree;
118module_param(dump_tree, bool, 0444);
116/* Control rcu_node-tree auto-balancing at boot time. */ 119/* Control rcu_node-tree auto-balancing at boot time. */
117static bool rcu_fanout_exact; 120static bool rcu_fanout_exact;
118module_param(rcu_fanout_exact, bool, 0444); 121module_param(rcu_fanout_exact, bool, 0444);
@@ -4144,6 +4147,28 @@ static void __init rcu_init_geometry(void)
4144 rcu_num_nodes -= n; 4147 rcu_num_nodes -= n;
4145} 4148}
4146 4149
4150/*
4151 * Dump out the structure of the rcu_node combining tree associated
4152 * with the rcu_state structure referenced by rsp.
4153 */
4154static void __init rcu_dump_rcu_node_tree(struct rcu_state *rsp)
4155{
4156 int level = 0;
4157 struct rcu_node *rnp;
4158
4159 pr_info("rcu_node tree layout dump\n");
4160 pr_info(" ");
4161 rcu_for_each_node_breadth_first(rsp, rnp) {
4162 if (rnp->level != level) {
4163 pr_cont("\n");
4164 pr_info(" ");
4165 level = rnp->level;
4166 }
4167 pr_cont("%d:%d ^%d ", rnp->grplo, rnp->grphi, rnp->grpnum);
4168 }
4169 pr_cont("\n");
4170}
4171
4147void __init rcu_init(void) 4172void __init rcu_init(void)
4148{ 4173{
4149 int cpu; 4174 int cpu;
@@ -4154,6 +4179,8 @@ void __init rcu_init(void)
4154 rcu_init_geometry(); 4179 rcu_init_geometry();
4155 rcu_init_one(&rcu_bh_state, &rcu_bh_data); 4180 rcu_init_one(&rcu_bh_state, &rcu_bh_data);
4156 rcu_init_one(&rcu_sched_state, &rcu_sched_data); 4181 rcu_init_one(&rcu_sched_state, &rcu_sched_data);
4182 if (dump_tree)
4183 rcu_dump_rcu_node_tree(&rcu_sched_state);
4157 __rcu_init_preempt(); 4184 __rcu_init_preempt();
4158 open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); 4185 open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
4159 4186