rcu: move some code from macro to function
PATCH 1/1 rcu: move some code from macro to function
cleanup: move some code from macro to function
---
kernel/rcutree.c +9 -9
@@ -1849,6 +1849,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); + } }/*
@@ -1859,19 +1867,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 )
Quoted 2 lines · Lai Jiangshan
cleanup: move some code from macro to function
Nice!
I have queued this for RCU 2.6.35, with the following commit message:
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.
Seem reasonable?
Thanx, Paul
Quoted 43 lines
Signed-off-by Lai Jiangshan <[email protected]>---
kernel/rcutree.c +9
-9@@ -1849,6 +1849,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); + } }/* @@ -1859,19 +1867,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 )
Quoted 15 lines · Paul E. McKenney
Quoted 1 line · Lai Jiangshan
cleanup: move some code from macro to function
Nice!
I have queued this for RCU 2.6.35, with the following commit message:
Shrink the
RCU_INIT_FLAVOR()macro by moving all but the initialization of the ->rda[] array torcu_init_one(). The call torcu_init_one()can then be moved to the end of theRCU_INIT_FLAVOR()macro, which is required becausercu_boot_init_percpu_data(), which is now called fromrcu_init_one(), depends on the initialization of the ->rda[] array.
Quoted 4 lines
Seem reasonable?
Thanx, Paul
OK
Thanks, Lai