aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/rcutree.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-03-19 14:53:31 -0400
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2013-06-10 16:39:43 -0400
commitba9fbe955f026780e6b27c279dba7c86dfdcb7d5 (patch)
treee2e778711810b1fdf4228504518e149584cfa789 /kernel/rcutree.c
parent470716fc043aba2fea832334e58d5cd5d82288a3 (diff)
rcu: Merge __rcu_process_gp_end() into __note_gp_changes()
This commit eliminates some duplicated code by merging __rcu_process_gp_end() into __note_gp_changes(). Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r--kernel/rcutree.c48
1 files changed, 6 insertions, 42 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index b04f134ab8bc..ac8f03c41476 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -1254,18 +1254,16 @@ static void rcu_advance_cbs(struct rcu_state *rsp, struct rcu_node *rnp,
1254} 1254}
1255 1255
1256/* 1256/*
1257 * Advance this CPU's callbacks, but only if the current grace period 1257 * Update CPU-local rcu_data state to record the beginnings and ends of
1258 * has ended. This may be called only from the CPU to whom the rdp 1258 * grace periods. The caller must hold the ->lock of the leaf rcu_node
1259 * belongs. In addition, the corresponding leaf rcu_node structure's 1259 * structure corresponding to the current CPU, and must have irqs disabled.
1260 * ->lock must be held by the caller, with irqs disabled.
1261 */ 1260 */
1262static void 1261static void __note_gp_changes(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
1263__rcu_process_gp_end(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
1264{ 1262{
1265 /* Did another grace period end? */ 1263 /* Handle the ends of any preceding grace periods first. */
1266 if (rdp->completed == rnp->completed) { 1264 if (rdp->completed == rnp->completed) {
1267 1265
1268 /* No, so just accelerate recent callbacks. */ 1266 /* No grace period end, so just accelerate recent callbacks. */
1269 rcu_accelerate_cbs(rsp, rnp, rdp); 1267 rcu_accelerate_cbs(rsp, rnp, rdp);
1270 1268
1271 } else { 1269 } else {
@@ -1276,41 +1274,7 @@ __rcu_process_gp_end(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_dat
1276 /* Remember that we saw this grace-period completion. */ 1274 /* Remember that we saw this grace-period completion. */
1277 rdp->completed = rnp->completed; 1275 rdp->completed = rnp->completed;
1278 trace_rcu_grace_period(rsp->name, rdp->gpnum, "cpuend"); 1276 trace_rcu_grace_period(rsp->name, rdp->gpnum, "cpuend");
1279
1280 /*
1281 * If we were in an extended quiescent state, we may have
1282 * missed some grace periods that others CPUs handled on
1283 * our behalf. Catch up with this state to avoid noting
1284 * spurious new grace periods. If another grace period
1285 * has started, then rnp->gpnum will have advanced, so
1286 * we will detect this later on. Of course, any quiescent
1287 * states we found for the old GP are now invalid.
1288 */
1289 if (ULONG_CMP_LT(rdp->gpnum, rdp->completed)) {
1290 rdp->gpnum = rdp->completed;
1291 rdp->passed_quiesce = 0;
1292 }
1293
1294 /*
1295 * If RCU does not need a quiescent state from this CPU,
1296 * then make sure that this CPU doesn't go looking for one.
1297 */
1298 if ((rnp->qsmask & rdp->grpmask) == 0)
1299 rdp->qs_pending = 0;
1300 } 1277 }
1301}
1302
1303/*
1304 * Update CPU-local rcu_data state to record the newly noticed grace period.
1305 * This is used both when we started the grace period and when we notice
1306 * that someone else started the grace period. The caller must hold the
1307 * ->lock of the leaf rcu_node structure corresponding to the current CPU,
1308 * and must have irqs disabled.
1309 */
1310static void __note_gp_changes(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
1311{
1312 /* Handle the ends of any preceding grace periods first. */
1313 __rcu_process_gp_end(rsp, rnp, rdp);
1314 1278
1315 if (rdp->gpnum != rnp->gpnum) { 1279 if (rdp->gpnum != rnp->gpnum) {
1316 /* 1280 /*