aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcu/tree.c
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@redhat.com>2015-06-03 02:18:29 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-07-15 17:45:19 -0400
commit199977bff9efceec649d74510fa9754e107ce0c5 (patch)
treec8535438ad8ef9772aec20a1cab3cc3180432b86 /kernel/rcu/tree.c
parent05b84aec465c34da242a224d2438d192ca0feec7 (diff)
rcu: Remove unnecessary fields from rcu_state structure
Members rcu_state::levelcnt[] and rcu_state::levelspread[] are only used at init. There is no reason to keep them afterwards. 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>
Diffstat (limited to 'kernel/rcu/tree.c')
-rw-r--r--kernel/rcu/tree.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 2ec7b796f660..7226e25ba97f 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3967,22 +3967,22 @@ void rcu_scheduler_starting(void)
3967 * Compute the per-level fanout, either using the exact fanout specified 3967 * Compute the per-level fanout, either using the exact fanout specified
3968 * or balancing the tree, depending on the rcu_fanout_exact boot parameter. 3968 * or balancing the tree, depending on the rcu_fanout_exact boot parameter.
3969 */ 3969 */
3970static void __init rcu_init_levelspread(struct rcu_state *rsp) 3970static void __init rcu_init_levelspread(int *levelspread, const int *levelcnt)
3971{ 3971{
3972 int i; 3972 int i;
3973 3973
3974 if (rcu_fanout_exact) { 3974 if (rcu_fanout_exact) {
3975 rsp->levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf; 3975 levelspread[rcu_num_lvls - 1] = rcu_fanout_leaf;
3976 for (i = rcu_num_lvls - 2; i >= 0; i--) 3976 for (i = rcu_num_lvls - 2; i >= 0; i--)
3977 rsp->levelspread[i] = RCU_FANOUT; 3977 levelspread[i] = RCU_FANOUT;
3978 } else { 3978 } else {
3979 int ccur; 3979 int ccur;
3980 int cprv; 3980 int cprv;
3981 3981
3982 cprv = nr_cpu_ids; 3982 cprv = nr_cpu_ids;
3983 for (i = rcu_num_lvls - 1; i >= 0; i--) { 3983 for (i = rcu_num_lvls - 1; i >= 0; i--) {
3984 ccur = rsp->levelcnt[i]; 3984 ccur = levelcnt[i];
3985 rsp->levelspread[i] = (cprv + ccur - 1) / ccur; 3985 levelspread[i] = (cprv + ccur - 1) / ccur;
3986 cprv = ccur; 3986 cprv = ccur;
3987 } 3987 }
3988 } 3988 }
@@ -4005,6 +4005,9 @@ static void __init rcu_init_one(struct rcu_state *rsp,
4005 "rcu_node_fqs_2", 4005 "rcu_node_fqs_2",
4006 "rcu_node_fqs_3" }; 4006 "rcu_node_fqs_3" };
4007 static u8 fl_mask = 0x1; 4007 static u8 fl_mask = 0x1;
4008
4009 int levelcnt[RCU_NUM_LVLS]; /* # nodes in each level. */
4010 int levelspread[RCU_NUM_LVLS]; /* kids/node in each level. */
4008 int cpustride = 1; 4011 int cpustride = 1;
4009 int i; 4012 int i;
4010 int j; 4013 int j;
@@ -4019,19 +4022,19 @@ static void __init rcu_init_one(struct rcu_state *rsp,
4019 /* Initialize the level-tracking arrays. */ 4022 /* Initialize the level-tracking arrays. */
4020 4023
4021 for (i = 0; i < rcu_num_lvls; i++) 4024 for (i = 0; i < rcu_num_lvls; i++)
4022 rsp->levelcnt[i] = num_rcu_lvl[i]; 4025 levelcnt[i] = num_rcu_lvl[i];
4023 for (i = 1; i < rcu_num_lvls; i++) 4026 for (i = 1; i < rcu_num_lvls; i++)
4024 rsp->level[i] = rsp->level[i - 1] + rsp->levelcnt[i - 1]; 4027 rsp->level[i] = rsp->level[i - 1] + levelcnt[i - 1];
4025 rcu_init_levelspread(rsp); 4028 rcu_init_levelspread(levelspread, levelcnt);
4026 rsp->flavor_mask = fl_mask; 4029 rsp->flavor_mask = fl_mask;
4027 fl_mask <<= 1; 4030 fl_mask <<= 1;
4028 4031
4029 /* Initialize the elements themselves, starting from the leaves. */ 4032 /* Initialize the elements themselves, starting from the leaves. */
4030 4033
4031 for (i = rcu_num_lvls - 1; i >= 0; i--) { 4034 for (i = rcu_num_lvls - 1; i >= 0; i--) {
4032 cpustride *= rsp->levelspread[i]; 4035 cpustride *= levelspread[i];
4033 rnp = rsp->level[i]; 4036 rnp = rsp->level[i];
4034 for (j = 0; j < rsp->levelcnt[i]; j++, rnp++) { 4037 for (j = 0; j < levelcnt[i]; j++, rnp++) {
4035 raw_spin_lock_init(&rnp->lock); 4038 raw_spin_lock_init(&rnp->lock);
4036 lockdep_set_class_and_name(&rnp->lock, 4039 lockdep_set_class_and_name(&rnp->lock,
4037 &rcu_node_class[i], buf[i]); 4040 &rcu_node_class[i], buf[i]);
@@ -4051,10 +4054,10 @@ static void __init rcu_init_one(struct rcu_state *rsp,
4051 rnp->grpmask = 0; 4054 rnp->grpmask = 0;
4052 rnp->parent = NULL; 4055 rnp->parent = NULL;
4053 } else { 4056 } else {
4054 rnp->grpnum = j % rsp->levelspread[i - 1]; 4057 rnp->grpnum = j % levelspread[i - 1];
4055 rnp->grpmask = 1UL << rnp->grpnum; 4058 rnp->grpmask = 1UL << rnp->grpnum;
4056 rnp->parent = rsp->level[i - 1] + 4059 rnp->parent = rsp->level[i - 1] +
4057 j / rsp->levelspread[i - 1]; 4060 j / levelspread[i - 1];
4058 } 4061 }
4059 rnp->level = i; 4062 rnp->level = i;
4060 INIT_LIST_HEAD(&rnp->blkd_tasks); 4063 INIT_LIST_HEAD(&rnp->blkd_tasks);