Skip to content

Commit 46103fe

Browse files
qiangzh3joelagnel
authored andcommitted
rcu: Remove never-set needwake assignment from rcu_report_qs_rdp()
The rcu_accelerate_cbs() function is invoked by rcu_report_qs_rdp() only if there is a grace period in progress that is still blocked by at least one CPU on this rcu_node structure. This means that rcu_accelerate_cbs() should never return the value true, and thus that this function should never set the needwake variable and in turn never invoke rcu_gp_kthread_wake(). This commit therefore removes the needwake variable and the invocation of rcu_gp_kthread_wake() in favor of a WARN_ON_ONCE() on the call to rcu_accelerate_cbs(). The purpose of this new WARN_ON_ONCE() is to detect situations where the system's opinion differs from ours. Signed-off-by: Zqiang <qiang1.zhang@intel.com> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
1 parent 2450b78 commit 46103fe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

kernel/rcu/tree.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,6 @@ rcu_report_qs_rdp(struct rcu_data *rdp)
19551955
{
19561956
unsigned long flags;
19571957
unsigned long mask;
1958-
bool needwake = false;
19591958
bool needacc = false;
19601959
struct rcu_node *rnp;
19611960

@@ -1987,7 +1986,12 @@ rcu_report_qs_rdp(struct rcu_data *rdp)
19871986
* NOCB kthreads have their own way to deal with that...
19881987
*/
19891988
if (!rcu_rdp_is_offloaded(rdp)) {
1990-
needwake = rcu_accelerate_cbs(rnp, rdp);
1989+
/*
1990+
* The current GP has not yet ended, so it
1991+
* should not be possible for rcu_accelerate_cbs()
1992+
* to return true. So complain, but don't awaken.
1993+
*/
1994+
WARN_ON_ONCE(rcu_accelerate_cbs(rnp, rdp));
19911995
} else if (!rcu_segcblist_completely_offloaded(&rdp->cblist)) {
19921996
/*
19931997
* ...but NOCB kthreads may miss or delay callbacks acceleration
@@ -1999,8 +2003,6 @@ rcu_report_qs_rdp(struct rcu_data *rdp)
19992003
rcu_disable_urgency_upon_qs(rdp);
20002004
rcu_report_qs_rnp(mask, rnp, rnp->gp_seq, flags);
20012005
/* ^^^ Released rnp->lock */
2002-
if (needwake)
2003-
rcu_gp_kthread_wake();
20042006

20052007
if (needacc) {
20062008
rcu_nocb_lock_irqsave(rdp, flags);

0 commit comments

Comments
 (0)