All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rcu] srcu: Guarantee non-negative return value from srcu_read_lock()
@ 2024-10-21 22:13 Paul E. McKenney
  2024-10-21 23:50 ` Andrii Nakryiko
  2024-10-22  6:51 ` Christoph Hellwig
  0 siblings, 2 replies; 22+ messages in thread
From: Paul E. McKenney @ 2024-10-21 22:13 UTC (permalink / raw)
  To: rcu; +Cc: linux-kernel, kernel-team, rostedt, peterz, andrii

For almost 20 years, the int return value from srcu_read_lock() has
been always either zero or one.  This commit therefore documents the
fact that it will be non-negative.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrii Nakryiko <andrii@kernel.org

diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index bab1dae3f69e6..512a8c54ba5ba 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -238,13 +238,14 @@ void srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor);
  * a mutex that is held elsewhere while calling synchronize_srcu() or
  * synchronize_srcu_expedited().
  *
- * The return value from srcu_read_lock() must be passed unaltered
- * to the matching srcu_read_unlock().  Note that srcu_read_lock() and
- * the matching srcu_read_unlock() must occur in the same context, for
- * example, it is illegal to invoke srcu_read_unlock() in an irq handler
- * if the matching srcu_read_lock() was invoked in process context.  Or,
- * for that matter to invoke srcu_read_unlock() from one task and the
- * matching srcu_read_lock() from another.
+ * The return value from srcu_read_lock() is guaranteed to be
+ * non-negative.  This value must be passed unaltered to the matching
+ * srcu_read_unlock().  Note that srcu_read_lock() and the matching
+ * srcu_read_unlock() must occur in the same context, for example, it is
+ * illegal to invoke srcu_read_unlock() in an irq handler if the matching
+ * srcu_read_lock() was invoked in process context.  Or, for that matter to
+ * invoke srcu_read_unlock() from one task and the matching srcu_read_lock()
+ * from another.
  */
 static inline int srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp)
 {

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-10-23 17:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21 22:13 [PATCH rcu] srcu: Guarantee non-negative return value from srcu_read_lock() Paul E. McKenney
2024-10-21 23:50 ` Andrii Nakryiko
2024-10-22  0:21   ` Paul E. McKenney
2024-10-22  2:01     ` Andrii Nakryiko
2024-10-22  3:30       ` Paul E. McKenney
2024-10-22  3:40         ` Andrii Nakryiko
2024-10-22  7:07         ` Peter Zijlstra
2024-10-22 14:27           ` Paul E. McKenney
2024-10-22  6:51 ` Christoph Hellwig
2024-10-22  7:06   ` Peter Zijlstra
2024-10-22  7:07     ` Christoph Hellwig
2024-10-22  7:10       ` Peter Zijlstra
2024-10-22  7:13         ` Christoph Hellwig
2024-10-22 14:26           ` Paul E. McKenney
2024-10-22 17:29             ` Andrii Nakryiko
2024-10-23  6:40               ` Christoph Hellwig
2024-10-23 16:34                 ` Andrii Nakryiko
2024-10-23 16:46                   ` Alan Huang
2024-10-23 16:59                     ` Andrii Nakryiko
2024-10-23  6:58             ` Alan Huang
2024-10-23 16:40               ` Paul E. McKenney
2024-10-23 16:56                 ` Alan Huang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.