rcu/nocb: Cancel nocb_timer upon nocb_gp wakeup
authorFrederic Weisbecker <frederic@kernel.org>
Tue, 23 Feb 2021 00:10:07 +0000 (01:10 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Wed, 12 May 2021 19:10:23 +0000 (12:10 -0700)
When waking up in nocb_gp_wait(), there is no need to keep the nocb_timer
around because this function will traverse the whole rdp list. Any
update performed before the timer was armed will now be visible after
the ->nocb_gp_lock acquire.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Neeraj Upadhyay <neeraju@codeaurora.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree_plugin.h

index 015adec5bdc5672e9724d40d33a10ed814a5b300..a667551a5501d8342a388e7cc479b7c1d4a67d6d 100644 (file)
@@ -2211,6 +2211,10 @@ static void nocb_gp_wait(struct rcu_data *my_rdp)
                raw_spin_lock_irqsave(&my_rdp->nocb_gp_lock, flags);
                if (bypass)
                        del_timer(&my_rdp->nocb_bypass_timer);
+               if (my_rdp->nocb_defer_wakeup > RCU_NOCB_WAKE_NOT) {
+                       WRITE_ONCE(my_rdp->nocb_defer_wakeup, RCU_NOCB_WAKE_NOT);
+                       del_timer(&my_rdp->nocb_timer);
+               }
                WRITE_ONCE(my_rdp->nocb_gp_sleep, true);
                raw_spin_unlock_irqrestore(&my_rdp->nocb_gp_lock, flags);
        }