diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2009-11-13 01:35:04 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-13 04:18:36 -0500 |
commit | 8e9aa8f067d2dcd9457980ced618e1cffbcfba46 (patch) | |
tree | bb32427c6a010435420e4b9481d2fdf1961fdc17 | |
parent | b32e9eb6ad29572b4451847d0e8227c9be2b6d69 (diff) |
rcu: Simplify association of forced quiescent states with grace periods
The force_quiescent_state() function also took a snapshot
of the ->completed field, which was as obnoxious as it was in
rcu_sched_qs() and friends. So snapshot ->gpnum-1.
Also, since the dyntick_record_completed() and
dyntick_recall_completed() functions are now simple assignments
that are independent of CONFIG_NO_HZ, and since their names are
now misleading, get rid of them.
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: <12580941042308-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/rcutree.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index b4efb9e36680..3df04381ea3e 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -178,29 +178,9 @@ static struct rcu_node *rcu_get_root(struct rcu_state *rsp) | |||
178 | return &rsp->node[0]; | 178 | return &rsp->node[0]; |
179 | } | 179 | } |
180 | 180 | ||
181 | /* | ||
182 | * Record the specified "completed" value, which is later used to validate | ||
183 | * dynticks counter manipulations and CPU-offline checks. Specify | ||
184 | * "rsp->completed - 1" to unconditionally invalidate any future dynticks | ||
185 | * manipulations and CPU-offline checks. Such invalidation is useful at | ||
186 | * the beginning of a grace period. | ||
187 | */ | ||
188 | static void dyntick_record_completed(struct rcu_state *rsp, long comp) | ||
189 | { | ||
190 | rsp->completed_fqs = comp; | ||
191 | } | ||
192 | |||
193 | #ifdef CONFIG_SMP | 181 | #ifdef CONFIG_SMP |
194 | 182 | ||
195 | /* | 183 | /* |
196 | * Recall the previously recorded value of the completion for dynticks. | ||
197 | */ | ||
198 | static long dyntick_recall_completed(struct rcu_state *rsp) | ||
199 | { | ||
200 | return rsp->completed_fqs; | ||
201 | } | ||
202 | |||
203 | /* | ||
204 | * If the specified CPU is offline, tell the caller that it is in | 184 | * If the specified CPU is offline, tell the caller that it is in |
205 | * a quiescent state. Otherwise, whack it with a reschedule IPI. | 185 | * a quiescent state. Otherwise, whack it with a reschedule IPI. |
206 | * Grace periods can end up waiting on an offline CPU when that | 186 | * Grace periods can end up waiting on an offline CPU when that |
@@ -702,7 +682,6 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags) | |||
702 | rsp->signaled = RCU_GP_INIT; /* Hold off force_quiescent_state. */ | 682 | rsp->signaled = RCU_GP_INIT; /* Hold off force_quiescent_state. */ |
703 | rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; | 683 | rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; |
704 | record_gp_stall_check_time(rsp); | 684 | record_gp_stall_check_time(rsp); |
705 | dyntick_record_completed(rsp, rsp->completed - 1); | ||
706 | 685 | ||
707 | /* Special-case the common single-level case. */ | 686 | /* Special-case the common single-level case. */ |
708 | if (NUM_RCU_NODES == 1) { | 687 | if (NUM_RCU_NODES == 1) { |
@@ -1214,7 +1193,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1214 | goto unlock_ret; /* no emergency and done recently. */ | 1193 | goto unlock_ret; /* no emergency and done recently. */ |
1215 | rsp->n_force_qs++; | 1194 | rsp->n_force_qs++; |
1216 | spin_lock(&rnp->lock); | 1195 | spin_lock(&rnp->lock); |
1217 | lastcomp = rsp->completed; | 1196 | lastcomp = rsp->gpnum - 1; |
1218 | signaled = rsp->signaled; | 1197 | signaled = rsp->signaled; |
1219 | rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; | 1198 | rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; |
1220 | if (lastcomp == rsp->gpnum) { | 1199 | if (lastcomp == rsp->gpnum) { |
@@ -1248,7 +1227,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1248 | if (lastcomp == rsp->completed && | 1227 | if (lastcomp == rsp->completed && |
1249 | rsp->signaled == signaled) { | 1228 | rsp->signaled == signaled) { |
1250 | rsp->signaled = RCU_FORCE_QS; | 1229 | rsp->signaled = RCU_FORCE_QS; |
1251 | dyntick_record_completed(rsp, lastcomp); | 1230 | rsp->completed_fqs = lastcomp; |
1252 | forcenow = signaled == RCU_SAVE_COMPLETED; | 1231 | forcenow = signaled == RCU_SAVE_COMPLETED; |
1253 | } | 1232 | } |
1254 | spin_unlock(&rnp->lock); | 1233 | spin_unlock(&rnp->lock); |
@@ -1259,7 +1238,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1259 | case RCU_FORCE_QS: | 1238 | case RCU_FORCE_QS: |
1260 | 1239 | ||
1261 | /* Check dyntick-idle state, send IPI to laggarts. */ | 1240 | /* Check dyntick-idle state, send IPI to laggarts. */ |
1262 | if (rcu_process_dyntick(rsp, dyntick_recall_completed(rsp), | 1241 | if (rcu_process_dyntick(rsp, rsp->completed_fqs, |
1263 | rcu_implicit_dynticks_qs)) | 1242 | rcu_implicit_dynticks_qs)) |
1264 | goto unlock_ret; | 1243 | goto unlock_ret; |
1265 | 1244 | ||