Skip to content

Commit dee39c0

Browse files
Zqiangneeraju
authored andcommitted
rcu: Force quiescent states only for ongoing grace period
If an rcutorture test scenario creates an fqs_task kthread, it will periodically invoke rcu_force_quiescent_state() in order to start force-quiescent-state (FQS) operations. However, an FQS operation will be started even if there is no RCU grace period in progress. Although testing FQS operations startup when there is no grace period in progress is necessary, it need not happen all that often. This commit therefore causes rcu_force_quiescent_state() to take an early exit if there is no grace period in progress. Note that there will still be attempts to start an FQS scan in the absence of a grace period because the grace period might end right after the rcu_force_quiescent_state() function's check. In actual testing, this happens about once every ten minutes, which should provide adequate testing. Signed-off-by: Zqiang <qiang.zhang1211@gmail.com> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Neeraj Upadhyay (AMD) <neeraj.iitr10@gmail.com>
1 parent 23d90b2 commit dee39c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/rcu/tree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,8 @@ void rcu_force_quiescent_state(void)
23382338
struct rcu_node *rnp;
23392339
struct rcu_node *rnp_old = NULL;
23402340

2341+
if (!rcu_gp_in_progress())
2342+
return;
23412343
/* Funnel through hierarchy to reduce memory contention. */
23422344
rnp = raw_cpu_read(rcu_data.mynode);
23432345
for (; rnp != NULL; rnp = rnp->parent) {

0 commit comments

Comments
 (0)