[PATCH RFC tip/core/rcu 03/16] rcu: move some code from macro to function

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paul E. McKenney
Date: Thursday, April 15, 2010 - 11:13 am

From: Lai Jiangshan <laijs@cn.fujitsu.com>

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 <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcutree.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 6042fb8..86bb949 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -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);
+	}
 }
 
 /*
@@ -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)
-- 
1.7.0

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH tip/core/rcu 0/16] rcu: v2 patches queued for 2.6.35, Paul E. McKenney, (Thu Apr 15, 11:12 am)
[PATCH RFC tip/core/rcu 01/16] rcu: substitute set_need_re ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 02/16] rcu: make dead code really dead, Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 03/16] rcu: move some code from ma ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 04/16] rcu: ignore offline CPUs in ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 05/16] rcu: Fix bogus CONFIG_PROVE ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 06/16] rcu: fix now-bogus rcu_sche ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by maki ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 08/16] rcu: rename rcutiny rcu_ctr ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 09/16] rcu: refactor RCU's context ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny by r ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 11/16] rcu: enable CPU_STALL_VERBO ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 12/16] rcu: disable CPU stall warn ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 13/16] rcu: print boot-time consol ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 14/16] rcu: improve RCU CPU stall- ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 15/16] rcu: permit discontiguous c ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
[PATCH RFC tip/core/rcu 16/16] rcu: v2: reduce the number ..., Paul E. McKenney, (Thu Apr 15, 11:13 am)
Re: [PATCH RFC tip/core/rcu 07/16] rcu: shrink rcutiny by ..., Paul E. McKenney, (Tue Apr 20, 8:05 am)
Re: [PATCH RFC tip/core/rcu 10/16] rcu: slim down rcutiny ..., Paul E. McKenney, (Tue Apr 20, 12:18 pm)