Commit 45f014c5 authored by Paul E. McKenney's avatar Paul E. McKenney Committed by Ingo Molnar

rcu: Remove redundant grace-period check

The rcu_process_dyntick() function checks twice for the end of
the current grace period.  However, it holds the current
rcu_node structure's ->lock field throughout, and doesn't get to
the second call to rcu_gp_in_progress() unless there is at least
one CPU corresponding to this rcu_node structure that has not
yet checked in for the current grace period, which would prevent
the current grace period from ending. So the current grace
period cannot have ended, and the second check is redundant, so
remove it.

Also, given that this function is used even with !CONFIG_NO_HZ,
its name is quite misleading.  Change from rcu_process_dyntick()
to force_qs_rnp().
Signed-off-by: default avatarPaul 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: <1262646550562-git-send-email->
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent ee47eb9f
...@@ -1146,8 +1146,7 @@ void rcu_check_callbacks(int cpu, int user) ...@@ -1146,8 +1146,7 @@ void rcu_check_callbacks(int cpu, int user)
* have not yet encountered a quiescent state, using the function specified. * have not yet encountered a quiescent state, using the function specified.
* The caller must have suppressed start of new grace periods. * The caller must have suppressed start of new grace periods.
*/ */
static void rcu_process_dyntick(struct rcu_state *rsp, static void force_qs_rnp(struct rcu_state *rsp, int (*f)(struct rcu_data *))
int (*f)(struct rcu_data *))
{ {
unsigned long bit; unsigned long bit;
int cpu; int cpu;
...@@ -1172,7 +1171,7 @@ static void rcu_process_dyntick(struct rcu_state *rsp, ...@@ -1172,7 +1171,7 @@ static void rcu_process_dyntick(struct rcu_state *rsp,
if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu])) if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu]))
mask |= bit; mask |= bit;
} }
if (mask != 0 && rcu_gp_in_progress(rsp)) { if (mask != 0) {
/* rcu_report_qs_rnp() releases rnp->lock. */ /* rcu_report_qs_rnp() releases rnp->lock. */
rcu_report_qs_rnp(mask, rsp, rnp, flags); rcu_report_qs_rnp(mask, rsp, rnp, flags);
...@@ -1222,7 +1221,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) ...@@ -1222,7 +1221,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
break; /* So gcc recognizes the dead code. */ break; /* So gcc recognizes the dead code. */
/* Record dyntick-idle state. */ /* Record dyntick-idle state. */
rcu_process_dyntick(rsp, dyntick_save_progress_counter); force_qs_rnp(rsp, dyntick_save_progress_counter);
spin_lock(&rnp->lock); /* irqs already disabled */ spin_lock(&rnp->lock); /* irqs already disabled */
if (rcu_gp_in_progress(rsp)) if (rcu_gp_in_progress(rsp))
rsp->signaled = RCU_FORCE_QS; rsp->signaled = RCU_FORCE_QS;
...@@ -1232,7 +1231,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) ...@@ -1232,7 +1231,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
/* Check dyntick-idle state, send IPI to laggarts. */ /* Check dyntick-idle state, send IPI to laggarts. */
spin_unlock(&rnp->lock); /* irqs remain disabled */ spin_unlock(&rnp->lock); /* irqs remain disabled */
rcu_process_dyntick(rsp, rcu_implicit_dynticks_qs); force_qs_rnp(rsp, rcu_implicit_dynticks_qs);
/* Leave state in case more forcing is required. */ /* Leave state in case more forcing is required. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment