diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-07-31 11:28:35 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2015-10-06 14:09:41 -0400 |
commit | ee968ac61d5a3440b931375d81113e0eedfcb249 (patch) | |
tree | ac6f4bc6727b19506941412b6d09c5fe44ca8b3d /kernel/rcu/tree.c | |
parent | bb73c52bad3666997ed2ec83c0c80c3f8ef55008 (diff) |
rcu: Eliminate panic when silly boot-time fanout specified
This commit loosens rcutree.rcu_fanout_leaf range checks
and replaces a panic() with a fallback to compile-time values.
This fallback is accompanied by a WARN_ON(), and both occur when the
rcutree.rcu_fanout_leaf value is too small to accommodate the number of
CPUs. For example, given the current four-level limit for the rcu_node
tree, a system with more than 16 CPUs built with CONFIG_FANOUT=2 must
have rcutree.rcu_fanout_leaf larger than 2.
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r-- | kernel/rcu/tree.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 93c0f23c3e45..713eb92314b4 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
@@ -4230,13 +4230,12 @@ static void __init rcu_init_geometry(void) | |||
4230 | rcu_fanout_leaf, nr_cpu_ids); | 4230 | rcu_fanout_leaf, nr_cpu_ids); |
4231 | 4231 | ||
4232 | /* | 4232 | /* |
4233 | * The boot-time rcu_fanout_leaf parameter is only permitted | 4233 | * The boot-time rcu_fanout_leaf parameter must be at least two |
4234 | * to increase the leaf-level fanout, not decrease it. Of course, | 4234 | * and cannot exceed the number of bits in the rcu_node masks. |
4235 | * the leaf-level fanout cannot exceed the number of bits in | 4235 | * Complain and fall back to the compile-time values if this |
4236 | * the rcu_node masks. Complain and fall back to the compile- | 4236 | * limit is exceeded. |
4237 | * time values if these limits are exceeded. | ||
4238 | */ | 4237 | */ |
4239 | if (rcu_fanout_leaf < RCU_FANOUT_LEAF || | 4238 | if (rcu_fanout_leaf < 2 || |
4240 | rcu_fanout_leaf > sizeof(unsigned long) * 8) { | 4239 | rcu_fanout_leaf > sizeof(unsigned long) * 8) { |
4241 | rcu_fanout_leaf = RCU_FANOUT_LEAF; | 4240 | rcu_fanout_leaf = RCU_FANOUT_LEAF; |
4242 | WARN_ON(1); | 4241 | WARN_ON(1); |
@@ -4253,10 +4252,13 @@ static void __init rcu_init_geometry(void) | |||
4253 | 4252 | ||
4254 | /* | 4253 | /* |
4255 | * The tree must be able to accommodate the configured number of CPUs. | 4254 | * The tree must be able to accommodate the configured number of CPUs. |
4256 | * If this limit is exceeded than we have a serious problem elsewhere. | 4255 | * If this limit is exceeded, fall back to the compile-time values. |
4257 | */ | 4256 | */ |
4258 | if (nr_cpu_ids > rcu_capacity[RCU_NUM_LVLS - 1]) | 4257 | if (nr_cpu_ids > rcu_capacity[RCU_NUM_LVLS - 1]) { |
4259 | panic("rcu_init_geometry: rcu_capacity[] is too small"); | 4258 | rcu_fanout_leaf = RCU_FANOUT_LEAF; |
4259 | WARN_ON(1); | ||
4260 | return; | ||
4261 | } | ||
4260 | 4262 | ||
4261 | /* Calculate the number of levels in the tree. */ | 4263 | /* Calculate the number of levels in the tree. */ |
4262 | for (i = 0; nr_cpu_ids > rcu_capacity[i]; i++) { | 4264 | for (i = 0; nr_cpu_ids > rcu_capacity[i]; i++) { |