summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2022-08-02 21:59:49 +0300
committerPaul E. McKenney <paulmck@kernel.org>2022-08-31 15:10:15 +0300
commitde3f2671ae563d24c679dcca36c9e0ebd9564ebd (patch)
tree0cd0a5fa7b7668a31f26df0a1d2a0fcfff642a49 /kernel
parentd66e4cf974a53c1195f1f5a96387ee5dbad2bdf2 (diff)
downloadlinux-de3f2671ae563d24c679dcca36c9e0ebd9564ebd.tar.xz
srcu: Make Tiny SRCU poll_state_synchronize_srcu() more precise
This commit applies the more-precise grace-period-state check used by rcu_seq_done_exact() to poll_state_synchronize_srcu(). This is important because Tiny SRCU uses a 16-bit counter, which can wrap quite quickly. If counter wrap continues to be a problem, then expanding ->srcu_idx and ->srcu_idx_max to 32 bits might be warranted. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rcu/srcutiny.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c
index 92c002d65482..a2af24f21467 100644
--- a/kernel/rcu/srcutiny.c
+++ b/kernel/rcu/srcutiny.c
@@ -240,10 +240,10 @@ EXPORT_SYMBOL_GPL(start_poll_synchronize_srcu);
*/
bool poll_state_synchronize_srcu(struct srcu_struct *ssp, unsigned long cookie)
{
- bool ret = USHORT_CMP_GE(READ_ONCE(ssp->srcu_idx), cookie);
+ unsigned short cur_s = READ_ONCE(ssp->srcu_idx);
barrier();
- return ret;
+ return USHORT_CMP_GE(cur_s, cookie) || USHORT_CMP_LT(cur_s, cookie - 3);
}
EXPORT_SYMBOL_GPL(poll_state_synchronize_srcu);