diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-01-04 18:09:07 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 03:06:04 -0500 |
commit | ee47eb9f4da6f44af965d6d049e77ee8c8a4b822 (patch) | |
tree | bc500b12150bd47afd34b24fd1db90939f5fec3b /kernel/rcutree.c | |
parent | 0f10dc826646134dce3e5751512b87d30f3903e4 (diff) |
rcu: Remove leg of force_quiescent_state() switch statement
The comparisons of rsp->gpnum nad rsp->completed in
rcu_process_dyntick() and force_quiescent_state() can be
replaced by the much more clear rcu_gp_in_progress() predicate
function. After doing this, it becomes clear that the
RCU_SAVE_COMPLETED leg of the force_quiescent_state() function's
switch statement is almost completely a no-op. A small change
to the RCU_SAVE_DYNTICK leg renders it a complete no-op, after
which it can be removed. Doing so also eliminates the forcenow
local variable from force_quiescent_state().
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: <12626465501781-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index e4971192fa9c..6268f37adfc4 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -1144,6 +1144,7 @@ void rcu_check_callbacks(int cpu, int user) | |||
1144 | /* | 1144 | /* |
1145 | * Scan the leaf rcu_node structures, processing dyntick state for any that | 1145 | * Scan the leaf rcu_node structures, processing dyntick state for any that |
1146 | * have not yet encountered a quiescent state, using the function specified. | 1146 | * have not yet encountered a quiescent state, using the function specified. |
1147 | * The caller must have suppressed start of new grace periods. | ||
1147 | */ | 1148 | */ |
1148 | static void rcu_process_dyntick(struct rcu_state *rsp, | 1149 | static void rcu_process_dyntick(struct rcu_state *rsp, |
1149 | int (*f)(struct rcu_data *)) | 1150 | int (*f)(struct rcu_data *)) |
@@ -1157,7 +1158,7 @@ static void rcu_process_dyntick(struct rcu_state *rsp, | |||
1157 | rcu_for_each_leaf_node(rsp, rnp) { | 1158 | rcu_for_each_leaf_node(rsp, rnp) { |
1158 | mask = 0; | 1159 | mask = 0; |
1159 | spin_lock_irqsave(&rnp->lock, flags); | 1160 | spin_lock_irqsave(&rnp->lock, flags); |
1160 | if (rnp->completed != rsp->gpnum - 1) { | 1161 | if (!rcu_gp_in_progress(rsp)) { |
1161 | spin_unlock_irqrestore(&rnp->lock, flags); | 1162 | spin_unlock_irqrestore(&rnp->lock, flags); |
1162 | return; | 1163 | return; |
1163 | } | 1164 | } |
@@ -1171,7 +1172,7 @@ static void rcu_process_dyntick(struct rcu_state *rsp, | |||
1171 | if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu])) | 1172 | if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu])) |
1172 | mask |= bit; | 1173 | mask |= bit; |
1173 | } | 1174 | } |
1174 | if (mask != 0 && rnp->completed == rsp->gpnum - 1) { | 1175 | if (mask != 0 && rcu_gp_in_progress(rsp)) { |
1175 | 1176 | ||
1176 | /* rcu_report_qs_rnp() releases rnp->lock. */ | 1177 | /* rcu_report_qs_rnp() releases rnp->lock. */ |
1177 | rcu_report_qs_rnp(mask, rsp, rnp, flags); | 1178 | rcu_report_qs_rnp(mask, rsp, rnp, flags); |
@@ -1189,7 +1190,6 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1189 | { | 1190 | { |
1190 | unsigned long flags; | 1191 | unsigned long flags; |
1191 | struct rcu_node *rnp = rcu_get_root(rsp); | 1192 | struct rcu_node *rnp = rcu_get_root(rsp); |
1192 | u8 forcenow; | ||
1193 | 1193 | ||
1194 | if (!rcu_gp_in_progress(rsp)) | 1194 | if (!rcu_gp_in_progress(rsp)) |
1195 | return; /* No grace period in progress, nothing to force. */ | 1195 | return; /* No grace period in progress, nothing to force. */ |
@@ -1224,21 +1224,9 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1224 | /* Record dyntick-idle state. */ | 1224 | /* Record dyntick-idle state. */ |
1225 | rcu_process_dyntick(rsp, dyntick_save_progress_counter); | 1225 | rcu_process_dyntick(rsp, dyntick_save_progress_counter); |
1226 | spin_lock(&rnp->lock); /* irqs already disabled */ | 1226 | spin_lock(&rnp->lock); /* irqs already disabled */ |
1227 | if (!rcu_gp_in_progress(rsp)) | 1227 | if (rcu_gp_in_progress(rsp)) |
1228 | break; | ||
1229 | /* fall into next case. */ | ||
1230 | |||
1231 | case RCU_SAVE_COMPLETED: | ||
1232 | |||
1233 | /* Update state, record completion counter. */ | ||
1234 | forcenow = 0; | ||
1235 | if (rsp->gpnum - 1 == rsp->completed) { | ||
1236 | forcenow = rsp->signaled == RCU_SAVE_COMPLETED; | ||
1237 | rsp->signaled = RCU_FORCE_QS; | 1228 | rsp->signaled = RCU_FORCE_QS; |
1238 | } | 1229 | break; |
1239 | if (!forcenow) | ||
1240 | break; | ||
1241 | /* fall into next case. */ | ||
1242 | 1230 | ||
1243 | case RCU_FORCE_QS: | 1231 | case RCU_FORCE_QS: |
1244 | 1232 | ||