Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcu/nocb: Only cancel nocb timer if not polling

This commit refrains deleting the ->nocb_timer if rcu_nocb is polling
because it should not ever have been queued in the polling case.

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>

authored by

Frederic Weisbecker and committed by
Paul E. McKenney
f9fc166b 3b2348e2

+7 -7
+7 -7
kernel/rcu/tree_plugin.h
··· 2176 2176 my_rdp->nocb_gp_gp = needwait_gp; 2177 2177 my_rdp->nocb_gp_seq = needwait_gp ? wait_gp_seq : 0; 2178 2178 if (bypass) { 2179 - raw_spin_lock_irqsave(&my_rdp->nocb_gp_lock, flags); 2180 - // Avoid race with first bypass CB. 2181 - if (my_rdp->nocb_defer_wakeup > RCU_NOCB_WAKE_NOT) { 2182 - WRITE_ONCE(my_rdp->nocb_defer_wakeup, RCU_NOCB_WAKE_NOT); 2183 - del_timer(&my_rdp->nocb_timer); 2184 - } 2185 2179 if (!rcu_nocb_poll) { 2180 + raw_spin_lock_irqsave(&my_rdp->nocb_gp_lock, flags); 2181 + // Avoid race with first bypass CB. 2182 + if (my_rdp->nocb_defer_wakeup > RCU_NOCB_WAKE_NOT) { 2183 + WRITE_ONCE(my_rdp->nocb_defer_wakeup, RCU_NOCB_WAKE_NOT); 2184 + del_timer(&my_rdp->nocb_timer); 2185 + } 2186 2186 // At least one child with non-empty ->nocb_bypass, so set 2187 2187 // timer in order to avoid stranding its callbacks. 2188 2188 mod_timer(&my_rdp->nocb_bypass_timer, j + 2); 2189 + raw_spin_unlock_irqrestore(&my_rdp->nocb_gp_lock, flags); 2189 2190 } 2190 - raw_spin_unlock_irqrestore(&my_rdp->nocb_gp_lock, flags); 2191 2191 } 2192 2192 if (rcu_nocb_poll) { 2193 2193 /* Polling, so trace if first poll in the series. */