rcu: move some code from macro to function

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, May 18, 2010 - 9:59 am

Gitweb:     http://git.kernel.org/linus/0c34029abdfdea64420cb4264c4e91a776b22157
Commit:     0c34029abdfdea64420cb4264c4e91a776b22157
Parent:     f261414f0d56dd1a0e34888e27d1d4902ad052f3
Author:     Lai Jiangshan <laijs@cn.fujitsu.com>
AuthorDate: Sun Mar 28 11:12:30 2010 +0800
Committer:  Paul E. McKenney <paulmck@linux.vnet.ibm.com>
CommitDate: Mon May 10 11:08:31 2010 -0700

    rcu: move some code from macro to function
    
    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)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
rcu: move some code from macro to function, Linux Kernel Mailing ..., (Tue May 18, 9:59 am)