Skip to content

Commit 8a77f38

Browse files
author
Frederic Weisbecker
committed
srcu: Only accelerate on enqueue time
Acceleration in SRCU happens on enqueue time for each new callback. This operation is expected not to fail and therefore any similar attempt from other places shouldn't find any remaining callbacks to accelerate. Moreover accelerations performed beyond enqueue time are error prone because rcu_seq_snap() then may return the snapshot for a new grace period that is not going to be started. Remove these dangerous and needless accelerations and introduce instead assertions reporting leaking unaccelerated callbacks beyond enqueue time. Co-developed-by: Yong He <alexyonghe@tencent.com> Signed-off-by: Yong He <alexyonghe@tencent.com> Co-developed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> Co-developed-by: Neeraj upadhyay <Neeraj.Upadhyay@amd.com> Signed-off-by: Neeraj upadhyay <Neeraj.Upadhyay@amd.com> Reviewed-by: Like Xu <likexu@tencent.com> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent 4a8e65b commit 8a77f38

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

kernel/rcu/srcutree.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,7 @@ static void srcu_gp_start(struct srcu_struct *ssp)
784784
spin_lock_rcu_node(sdp); /* Interrupts already disabled. */
785785
rcu_segcblist_advance(&sdp->srcu_cblist,
786786
rcu_seq_current(&ssp->srcu_sup->srcu_gp_seq));
787-
(void)rcu_segcblist_accelerate(&sdp->srcu_cblist,
788-
rcu_seq_snap(&ssp->srcu_sup->srcu_gp_seq));
787+
WARN_ON_ONCE(!rcu_segcblist_segempty(&sdp->srcu_cblist, RCU_NEXT_TAIL));
789788
spin_unlock_rcu_node(sdp); /* Interrupts remain disabled. */
790789
WRITE_ONCE(ssp->srcu_sup->srcu_gp_start, jiffies);
791790
WRITE_ONCE(ssp->srcu_sup->srcu_n_exp_nodelay, 0);
@@ -1721,6 +1720,7 @@ static void srcu_invoke_callbacks(struct work_struct *work)
17211720
ssp = sdp->ssp;
17221721
rcu_cblist_init(&ready_cbs);
17231722
spin_lock_irq_rcu_node(sdp);
1723+
WARN_ON_ONCE(!rcu_segcblist_segempty(&sdp->srcu_cblist, RCU_NEXT_TAIL));
17241724
rcu_segcblist_advance(&sdp->srcu_cblist,
17251725
rcu_seq_current(&ssp->srcu_sup->srcu_gp_seq));
17261726
if (sdp->srcu_cblist_invoking ||
@@ -1750,8 +1750,6 @@ static void srcu_invoke_callbacks(struct work_struct *work)
17501750
*/
17511751
spin_lock_irq_rcu_node(sdp);
17521752
rcu_segcblist_add_len(&sdp->srcu_cblist, -len);
1753-
(void)rcu_segcblist_accelerate(&sdp->srcu_cblist,
1754-
rcu_seq_snap(&ssp->srcu_sup->srcu_gp_seq));
17551753
sdp->srcu_cblist_invoking = false;
17561754
more = rcu_segcblist_ready_cbs(&sdp->srcu_cblist);
17571755
spin_unlock_irq_rcu_node(sdp);

0 commit comments

Comments
 (0)