summaryrefslogtreecommitdiffstats
path: root/kernel/rcu
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-04-20 17:27:43 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-05-27 15:59:05 -0400
commit05c5df31afd1092ca6322094d22aff6351fa67fe (patch)
treedffce93d8da097a4701bfdafe4c23323371cd899 /kernel/rcu
parent8739c5cb0fb145aeed8c56ddb5ba79381c74cb97 (diff)
rcu: Make RCU able to tolerate undefined CONFIG_RCU_FANOUT
This commit introduces an RCU_FANOUT C-preprocessor macro so that RCU will build even when CONFIG_RCU_FANOUT is undefined. The RCU_FANOUT macro is set to the value of CONFIG_RCU_FANOUT when defined, otherwise it is set to 32 for 32-bit systems and 64 for 64-bit systems. This commit then makes CONFIG_RCU_FANOUT depend on CONFIG_RCU_EXPERT, so that Kconfig users won't be asked about CONFIG_RCU_FANOUT unless they want to be. Reported-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Pranith Kumar <bobby.prani@gmail.com>
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/tree.c4
-rw-r--r--kernel/rcu/tree.h18
-rw-r--r--kernel/rcu/tree_plugin.h6
3 files changed, 20 insertions, 8 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 1bc14c670641..ba3f8d59d948 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3971,7 +3971,7 @@ static void __init rcu_init_levelspread(struct rcu_state *rsp)
3971 if (rcu_fanout_exact) { 3971 if (rcu_fanout_exact) {
3972 rsp->levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf; 3972 rsp->levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
3973 for (i = rcu_num_lvls - 2; i >= 0; i--) 3973 for (i = rcu_num_lvls - 2; i >= 0; i--)
3974 rsp->levelspread[i] = CONFIG_RCU_FANOUT; 3974 rsp->levelspread[i] = RCU_FANOUT;
3975 } else { 3975 } else {
3976 int ccur; 3976 int ccur;
3977 int cprv; 3977 int cprv;
@@ -4111,7 +4111,7 @@ static void __init rcu_init_geometry(void)
4111 rcu_capacity[0] = 1; 4111 rcu_capacity[0] = 1;
4112 rcu_capacity[1] = rcu_fanout_leaf; 4112 rcu_capacity[1] = rcu_fanout_leaf;
4113 for (i = 2; i <= MAX_RCU_LVLS; i++) 4113 for (i = 2; i <= MAX_RCU_LVLS; i++)
4114 rcu_capacity[i] = rcu_capacity[i - 1] * CONFIG_RCU_FANOUT; 4114 rcu_capacity[i] = rcu_capacity[i - 1] * RCU_FANOUT;
4115 4115
4116 /* 4116 /*
4117 * The boot-time rcu_fanout_leaf parameter is only permitted 4117 * The boot-time rcu_fanout_leaf parameter is only permitted
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index a69d3dab2ec4..ac3020fff028 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -35,11 +35,23 @@
35 * In practice, this did work well going from three levels to four. 35 * In practice, this did work well going from three levels to four.
36 * Of course, your mileage may vary. 36 * Of course, your mileage may vary.
37 */ 37 */
38
38#define MAX_RCU_LVLS 4 39#define MAX_RCU_LVLS 4
40
41#ifdef CONFIG_RCU_FANOUT
42#define RCU_FANOUT CONFIG_RCU_FANOUT
43#else /* #ifdef CONFIG_RCU_FANOUT */
44# ifdef CONFIG_64BIT
45# define RCU_FANOUT 64
46# else
47# define RCU_FANOUT 32
48# endif
49#endif /* #else #ifdef CONFIG_RCU_FANOUT */
50
39#define RCU_FANOUT_1 (CONFIG_RCU_FANOUT_LEAF) 51#define RCU_FANOUT_1 (CONFIG_RCU_FANOUT_LEAF)
40#define RCU_FANOUT_2 (RCU_FANOUT_1 * CONFIG_RCU_FANOUT) 52#define RCU_FANOUT_2 (RCU_FANOUT_1 * RCU_FANOUT)
41#define RCU_FANOUT_3 (RCU_FANOUT_2 * CONFIG_RCU_FANOUT) 53#define RCU_FANOUT_3 (RCU_FANOUT_2 * RCU_FANOUT)
42#define RCU_FANOUT_4 (RCU_FANOUT_3 * CONFIG_RCU_FANOUT) 54#define RCU_FANOUT_4 (RCU_FANOUT_3 * RCU_FANOUT)
43 55
44#if NR_CPUS <= RCU_FANOUT_1 56#if NR_CPUS <= RCU_FANOUT_1
45# define RCU_NUM_LVLS 1 57# define RCU_NUM_LVLS 1
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index eb460ec747ef..d7e505970f24 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -60,10 +60,10 @@ static void __init rcu_bootup_announce_oddness(void)
60{ 60{
61 if (IS_ENABLED(CONFIG_RCU_TRACE)) 61 if (IS_ENABLED(CONFIG_RCU_TRACE))
62 pr_info("\tRCU debugfs-based tracing is enabled.\n"); 62 pr_info("\tRCU debugfs-based tracing is enabled.\n");
63 if ((IS_ENABLED(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 64) || 63 if ((IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 64) ||
64 (!IS_ENABLED(CONFIG_64BIT) && CONFIG_RCU_FANOUT != 32)) 64 (!IS_ENABLED(CONFIG_64BIT) && RCU_FANOUT != 32))
65 pr_info("\tCONFIG_RCU_FANOUT set to non-default value of %d\n", 65 pr_info("\tCONFIG_RCU_FANOUT set to non-default value of %d\n",
66 CONFIG_RCU_FANOUT); 66 RCU_FANOUT);
67 if (rcu_fanout_exact) 67 if (rcu_fanout_exact)
68 pr_info("\tHierarchical RCU autobalancing is disabled.\n"); 68 pr_info("\tHierarchical RCU autobalancing is disabled.\n");
69 if (IS_ENABLED(CONFIG_RCU_FAST_NO_HZ)) 69 if (IS_ENABLED(CONFIG_RCU_FAST_NO_HZ))