aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@redhat.com>2015-06-03 02:18:30 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-07-15 17:45:20 -0400
commitcb007102398edd06ffc4488bf841c2e10f14d2e7 (patch)
tree617798e5e989c19032c3219dcddf24256670abdd
parent199977bff9efceec649d74510fa9754e107ce0c5 (diff)
rcu: Limit count of static data to the number of RCU levels
Although a number of RCU levels may be less than the current maximum of four, some static data associated with each level are allocated for all four levels. As result, the extra data never get accessed and just wast memory. This update limits count of allocated items to the number of used RCU levels. Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--kernel/rcu/tree.c21
-rw-r--r--kernel/rcu/tree.h12
2 files changed, 16 insertions, 17 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 7226e25ba97f..e53bbc53bcd5 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -124,13 +124,8 @@ module_param(rcu_fanout_exact, bool, 0444);
124static int rcu_fanout_leaf = RCU_FANOUT_LEAF; 124static int rcu_fanout_leaf = RCU_FANOUT_LEAF;
125module_param(rcu_fanout_leaf, int, 0444); 125module_param(rcu_fanout_leaf, int, 0444);
126int rcu_num_lvls __read_mostly = RCU_NUM_LVLS; 126int rcu_num_lvls __read_mostly = RCU_NUM_LVLS;
127static int num_rcu_lvl[] = { /* Number of rcu_nodes at specified level. */ 127/* Number of rcu_nodes at specified level. */
128 NUM_RCU_LVL_0, 128static int num_rcu_lvl[] = NUM_RCU_LVL_INIT;
129 NUM_RCU_LVL_1,
130 NUM_RCU_LVL_2,
131 NUM_RCU_LVL_3,
132 NUM_RCU_LVL_4,
133};
134int rcu_num_nodes __read_mostly = NUM_RCU_NODES; /* Total # rcu_nodes in use. */ 129int rcu_num_nodes __read_mostly = NUM_RCU_NODES; /* Total # rcu_nodes in use. */
135 130
136/* 131/*
@@ -3994,16 +3989,8 @@ static void __init rcu_init_levelspread(int *levelspread, const int *levelcnt)
3994static void __init rcu_init_one(struct rcu_state *rsp, 3989static void __init rcu_init_one(struct rcu_state *rsp,
3995 struct rcu_data __percpu *rda) 3990 struct rcu_data __percpu *rda)
3996{ 3991{
3997 static const char * const buf[] = { 3992 static const char * const buf[] = RCU_NODE_NAME_INIT;
3998 "rcu_node_0", 3993 static const char * const fqs[] = RCU_FQS_NAME_INIT;
3999 "rcu_node_1",
4000 "rcu_node_2",
4001 "rcu_node_3" };
4002 static const char * const fqs[] = {
4003 "rcu_node_fqs_0",
4004 "rcu_node_fqs_1",
4005 "rcu_node_fqs_2",
4006 "rcu_node_fqs_3" };
4007 static u8 fl_mask = 0x1; 3994 static u8 fl_mask = 0x1;
4008 3995
4009 int levelcnt[RCU_NUM_LVLS]; /* # nodes in each level. */ 3996 int levelcnt[RCU_NUM_LVLS]; /* # nodes in each level. */
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 3413f3c5c8b2..d44856b6170a 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -68,6 +68,9 @@
68# define NUM_RCU_LVL_2 0 68# define NUM_RCU_LVL_2 0
69# define NUM_RCU_LVL_3 0 69# define NUM_RCU_LVL_3 0
70# define NUM_RCU_LVL_4 0 70# define NUM_RCU_LVL_4 0
71# define NUM_RCU_LVL_INIT { NUM_RCU_LVL_0 }
72# define RCU_NODE_NAME_INIT { "rcu_node_0" }
73# define RCU_FQS_NAME_INIT { "rcu_node_fqs_0" }
71#elif NR_CPUS <= RCU_FANOUT_2 74#elif NR_CPUS <= RCU_FANOUT_2
72# define RCU_NUM_LVLS 2 75# define RCU_NUM_LVLS 2
73# define NUM_RCU_LVL_0 1 76# define NUM_RCU_LVL_0 1
@@ -75,6 +78,9 @@
75# define NUM_RCU_LVL_2 (NR_CPUS) 78# define NUM_RCU_LVL_2 (NR_CPUS)
76# define NUM_RCU_LVL_3 0 79# define NUM_RCU_LVL_3 0
77# define NUM_RCU_LVL_4 0 80# define NUM_RCU_LVL_4 0
81# define NUM_RCU_LVL_INIT { NUM_RCU_LVL_0, NUM_RCU_LVL_1 }
82# define RCU_NODE_NAME_INIT { "rcu_node_0", "rcu_node_1" }
83# define RCU_FQS_NAME_INIT { "rcu_node_fqs_0", "rcu_node_fqs_1" }
78#elif NR_CPUS <= RCU_FANOUT_3 84#elif NR_CPUS <= RCU_FANOUT_3
79# define RCU_NUM_LVLS 3 85# define RCU_NUM_LVLS 3
80# define NUM_RCU_LVL_0 1 86# define NUM_RCU_LVL_0 1
@@ -82,6 +88,9 @@
82# define NUM_RCU_LVL_2 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1) 88# define NUM_RCU_LVL_2 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1)
83# define NUM_RCU_LVL_3 (NR_CPUS) 89# define NUM_RCU_LVL_3 (NR_CPUS)
84# define NUM_RCU_LVL_4 0 90# define NUM_RCU_LVL_4 0
91# define NUM_RCU_LVL_INIT { NUM_RCU_LVL_0, NUM_RCU_LVL_1, NUM_RCU_LVL_2 }
92# define RCU_NODE_NAME_INIT { "rcu_node_0", "rcu_node_1", "rcu_node_2" }
93# define RCU_FQS_NAME_INIT { "rcu_node_fqs_0", "rcu_node_fqs_1", "rcu_node_fqs_2" }
85#elif NR_CPUS <= RCU_FANOUT_4 94#elif NR_CPUS <= RCU_FANOUT_4
86# define RCU_NUM_LVLS 4 95# define RCU_NUM_LVLS 4
87# define NUM_RCU_LVL_0 1 96# define NUM_RCU_LVL_0 1
@@ -89,6 +98,9 @@
89# define NUM_RCU_LVL_2 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_2) 98# define NUM_RCU_LVL_2 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_2)
90# define NUM_RCU_LVL_3 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1) 99# define NUM_RCU_LVL_3 DIV_ROUND_UP(NR_CPUS, RCU_FANOUT_1)
91# define NUM_RCU_LVL_4 (NR_CPUS) 100# define NUM_RCU_LVL_4 (NR_CPUS)
101# define NUM_RCU_LVL_INIT { NUM_RCU_LVL_0, NUM_RCU_LVL_1, NUM_RCU_LVL_2, NUM_RCU_LVL_3 }
102# define RCU_NODE_NAME_INIT { "rcu_node_0", "rcu_node_1", "rcu_node_2", "rcu_node_3" }
103# define RCU_FQS_NAME_INIT { "rcu_node_fqs_0", "rcu_node_fqs_1", "rcu_node_fqs_2", "rcu_node_fqs_3" }
92#else 104#else
93# error "CONFIG_RCU_FANOUT insufficient for NR_CPUS" 105# error "CONFIG_RCU_FANOUT insufficient for NR_CPUS"
94#endif /* #if (NR_CPUS) <= RCU_FANOUT_1 */ 106#endif /* #if (NR_CPUS) <= RCU_FANOUT_1 */