diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-01-04 18:09:04 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 03:06:03 -0500 |
commit | 39c0bbfc07c6e28db7346d0e11106f2d045d3035 (patch) | |
tree | 82f0fdacb1eea0334e76e0adb8b9d5beec66f2a7 /kernel/rcutree.c | |
parent | f3a8b5c6aa543bd87764418d63632eb65b80e2f6 (diff) |
rcu: Eliminate local variable lastcomp from force_quiescent_state()
Because rsp->fqs_active is set to 1 across
force_quiescent_state()'s switch statement, rcu_start_gp() will
refrain from starting a new grace period during this time.
Therefore, rsp->gpnum is constant, and can be propagated to all
uses of lastcomp, eliminating this local variable.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
LKML-Reference: <12626465502985-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 1d8cfb1711fd..62b64332effb 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -1191,7 +1191,6 @@ static int rcu_process_dyntick(struct rcu_state *rsp, long lastcomp, | |||
1191 | static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | 1191 | static void force_quiescent_state(struct rcu_state *rsp, int relaxed) |
1192 | { | 1192 | { |
1193 | unsigned long flags; | 1193 | unsigned long flags; |
1194 | long lastcomp; | ||
1195 | struct rcu_node *rnp = rcu_get_root(rsp); | 1194 | struct rcu_node *rnp = rcu_get_root(rsp); |
1196 | u8 forcenow; | 1195 | u8 forcenow; |
1197 | u8 gpdone; | 1196 | u8 gpdone; |
@@ -1207,7 +1206,6 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1207 | goto unlock_fqs_ret; /* no emergency and done recently. */ | 1206 | goto unlock_fqs_ret; /* no emergency and done recently. */ |
1208 | rsp->n_force_qs++; | 1207 | rsp->n_force_qs++; |
1209 | spin_lock(&rnp->lock); /* irqs already disabled */ | 1208 | spin_lock(&rnp->lock); /* irqs already disabled */ |
1210 | lastcomp = rsp->gpnum - 1; | ||
1211 | rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; | 1209 | rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; |
1212 | if(!rcu_gp_in_progress(rsp)) { | 1210 | if(!rcu_gp_in_progress(rsp)) { |
1213 | rsp->n_force_qs_ngp++; | 1211 | rsp->n_force_qs_ngp++; |
@@ -1228,7 +1226,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1228 | break; /* So gcc recognizes the dead code. */ | 1226 | break; /* So gcc recognizes the dead code. */ |
1229 | 1227 | ||
1230 | /* Record dyntick-idle state. */ | 1228 | /* Record dyntick-idle state. */ |
1231 | gpdone = rcu_process_dyntick(rsp, lastcomp, | 1229 | gpdone = rcu_process_dyntick(rsp, rsp->gpnum - 1, |
1232 | dyntick_save_progress_counter); | 1230 | dyntick_save_progress_counter); |
1233 | spin_lock(&rnp->lock); /* irqs already disabled */ | 1231 | spin_lock(&rnp->lock); /* irqs already disabled */ |
1234 | if (gpdone) | 1232 | if (gpdone) |
@@ -1239,11 +1237,9 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1239 | 1237 | ||
1240 | /* Update state, record completion counter. */ | 1238 | /* Update state, record completion counter. */ |
1241 | forcenow = 0; | 1239 | forcenow = 0; |
1242 | if (lastcomp + 1 == rsp->gpnum && | 1240 | if (rsp->gpnum - 1 == rsp->completed) { |
1243 | lastcomp == rsp->completed) { | ||
1244 | forcenow = rsp->signaled == RCU_SAVE_COMPLETED; | 1241 | forcenow = rsp->signaled == RCU_SAVE_COMPLETED; |
1245 | rsp->signaled = RCU_FORCE_QS; | 1242 | rsp->signaled = RCU_FORCE_QS; |
1246 | rsp->completed_fqs = lastcomp; | ||
1247 | } | 1243 | } |
1248 | if (!forcenow) | 1244 | if (!forcenow) |
1249 | break; | 1245 | break; |
@@ -1253,7 +1249,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1253 | 1249 | ||
1254 | /* Check dyntick-idle state, send IPI to laggarts. */ | 1250 | /* Check dyntick-idle state, send IPI to laggarts. */ |
1255 | spin_unlock(&rnp->lock); /* irqs remain disabled */ | 1251 | spin_unlock(&rnp->lock); /* irqs remain disabled */ |
1256 | gpdone = rcu_process_dyntick(rsp, rsp->completed_fqs, | 1252 | gpdone = rcu_process_dyntick(rsp, rsp->gpnum - 1, |
1257 | rcu_implicit_dynticks_qs); | 1253 | rcu_implicit_dynticks_qs); |
1258 | 1254 | ||
1259 | /* Leave state in case more forcing is required. */ | 1255 | /* Leave state in case more forcing is required. */ |