diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2024-06-14 22:26:44 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2024-06-18 19:13:37 +0200 |
commit | e206f33e2c0774276a0497fe538472e12016a362 (patch) | |
tree | 780fd57184e3c55aa2cf9a48d90e5a98a9d622a5 /kernel/rcu | |
parent | srcu: Update cleanup_srcu_struct() comment (diff) | |
download | linux-e206f33e2c0774276a0497fe538472e12016a362.tar.xz linux-e206f33e2c0774276a0497fe538472e12016a362.zip |
srcu: Fill out polled grace-period APIs
This commit adds the get_completed_synchronize_srcu() and the
same_state_synchronize_srcu() functions. The first returns a cookie
that is always interpreted as corresponding to an expired grace period.
The second does an equality comparison of a pair of cookies.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'kernel/rcu')
-rw-r--r-- | kernel/rcu/srcutiny.c | 3 | ||||
-rw-r--r-- | kernel/rcu/srcutree.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c index 5afd5cf494db..549c03336ee9 100644 --- a/kernel/rcu/srcutiny.c +++ b/kernel/rcu/srcutiny.c @@ -277,7 +277,8 @@ bool poll_state_synchronize_srcu(struct srcu_struct *ssp, unsigned long cookie) unsigned long cur_s = READ_ONCE(ssp->srcu_idx); barrier(); - return ULONG_CMP_GE(cur_s, cookie) || ULONG_CMP_LT(cur_s, cookie - 3); + return cookie == SRCU_GET_STATE_COMPLETED || + ULONG_CMP_GE(cur_s, cookie) || ULONG_CMP_LT(cur_s, cookie - 3); } EXPORT_SYMBOL_GPL(poll_state_synchronize_srcu); diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 15dc22a8ff5a..d6a4047719cb 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -1543,7 +1543,8 @@ EXPORT_SYMBOL_GPL(start_poll_synchronize_srcu); */ bool poll_state_synchronize_srcu(struct srcu_struct *ssp, unsigned long cookie) { - if (!rcu_seq_done(&ssp->srcu_sup->srcu_gp_seq, cookie)) + if (cookie != SRCU_GET_STATE_COMPLETED && + !rcu_seq_done(&ssp->srcu_sup->srcu_gp_seq, cookie)) return false; // Ensure that the end of the SRCU grace period happens before // any subsequent code that the caller might execute. |