Skip to content

Commit

Permalink
rcu: move some code from macro to function
Browse files Browse the repository at this point in the history
Shrink the RCU_INIT_FLAVOR() macro by moving all but the initialization
of the ->rda[] array to rcu_init_one().  The call to rcu_init_one()
can then be moved to the end of the RCU_INIT_FLAVOR() macro, which is
required because rcu_boot_init_percpu_data(), which is now called from
rcu_init_one(), depends on the initialization of the ->rda[] array.

Signed-off-by: Lai Jiangshan <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
  • Loading branch information
Lai Jiangshan authored and paulmck committed May 10, 2010
1 parent f261414 commit 0c34029
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions kernel/rcutree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1859,6 +1859,14 @@ static void __init rcu_init_one(struct rcu_state *rsp)
INIT_LIST_HEAD(&rnp->blocked_tasks[3]);
}
}

rnp = rsp->level[NUM_RCU_LVLS - 1];
for_each_possible_cpu(i) {
if (i > rnp->grphi)
rnp++;
rsp->rda[i]->mynode = rnp;
rcu_boot_init_percpu_data(i, rsp);
}
}

/*
Expand All @@ -1869,19 +1877,11 @@ static void __init rcu_init_one(struct rcu_state *rsp)
#define RCU_INIT_FLAVOR(rsp, rcu_data) \
do { \
int i; \
int j; \
struct rcu_node *rnp; \
\
rcu_init_one(rsp); \
rnp = (rsp)->level[NUM_RCU_LVLS - 1]; \
j = 0; \
for_each_possible_cpu(i) { \
if (i > rnp[j].grphi) \
j++; \
per_cpu(rcu_data, i).mynode = &rnp[j]; \
(rsp)->rda[i] = &per_cpu(rcu_data, i); \
rcu_boot_init_percpu_data(i, rsp); \
} \
rcu_init_one(rsp); \
} while (0)

void __init rcu_init(void)
Expand Down

0 comments on commit 0c34029

Please sign in to comment.