diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2010-01-04 18:09:08 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 03:06:04 -0500 |
commit | 45f014c52eef022873b19d6a20eb0ec9668f2b09 (patch) | |
tree | 036e3987276a5e689869a47b3641d70588db2489 /kernel/rcutree.c | |
parent | ee47eb9f4da6f44af965d6d049e77ee8c8a4b822 (diff) |
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: 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: <1262646550562-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/rcutree.c')
-rw-r--r-- | kernel/rcutree.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 6268f37adfc4..d9202857d3ad 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -1146,8 +1146,7 @@ void rcu_check_callbacks(int cpu, int user) | |||
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 | * The caller must have suppressed start of new grace periods. |
1148 | */ | 1148 | */ |
1149 | static void rcu_process_dyntick(struct rcu_state *rsp, | 1149 | static void force_qs_rnp(struct rcu_state *rsp, int (*f)(struct rcu_data *)) |
1150 | int (*f)(struct rcu_data *)) | ||
1151 | { | 1150 | { |
1152 | unsigned long bit; | 1151 | unsigned long bit; |
1153 | int cpu; | 1152 | int cpu; |
@@ -1172,7 +1171,7 @@ static void rcu_process_dyntick(struct rcu_state *rsp, | |||
1172 | if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu])) | 1171 | if ((rnp->qsmask & bit) != 0 && f(rsp->rda[cpu])) |
1173 | mask |= bit; | 1172 | mask |= bit; |
1174 | } | 1173 | } |
1175 | if (mask != 0 && rcu_gp_in_progress(rsp)) { | 1174 | if (mask != 0) { |
1176 | 1175 | ||
1177 | /* rcu_report_qs_rnp() releases rnp->lock. */ | 1176 | /* rcu_report_qs_rnp() releases rnp->lock. */ |
1178 | rcu_report_qs_rnp(mask, rsp, rnp, flags); | 1177 | rcu_report_qs_rnp(mask, rsp, rnp, flags); |
@@ -1222,7 +1221,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1222 | break; /* So gcc recognizes the dead code. */ | 1221 | break; /* So gcc recognizes the dead code. */ |
1223 | 1222 | ||
1224 | /* Record dyntick-idle state. */ | 1223 | /* Record dyntick-idle state. */ |
1225 | rcu_process_dyntick(rsp, dyntick_save_progress_counter); | 1224 | force_qs_rnp(rsp, dyntick_save_progress_counter); |
1226 | spin_lock(&rnp->lock); /* irqs already disabled */ | 1225 | spin_lock(&rnp->lock); /* irqs already disabled */ |
1227 | if (rcu_gp_in_progress(rsp)) | 1226 | if (rcu_gp_in_progress(rsp)) |
1228 | rsp->signaled = RCU_FORCE_QS; | 1227 | rsp->signaled = RCU_FORCE_QS; |
@@ -1232,7 +1231,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed) | |||
1232 | 1231 | ||
1233 | /* Check dyntick-idle state, send IPI to laggarts. */ | 1232 | /* Check dyntick-idle state, send IPI to laggarts. */ |
1234 | spin_unlock(&rnp->lock); /* irqs remain disabled */ | 1233 | spin_unlock(&rnp->lock); /* irqs remain disabled */ |
1235 | rcu_process_dyntick(rsp, rcu_implicit_dynticks_qs); | 1234 | force_qs_rnp(rsp, rcu_implicit_dynticks_qs); |
1236 | 1235 | ||
1237 | /* Leave state in case more forcing is required. */ | 1236 | /* Leave state in case more forcing is required. */ |
1238 | 1237 | ||