Re: [PATCH 1/4] seqlock: introduce scoped_seqlock_read() and scoped_seqlock_read_irqsave()
From: Waiman Long
Date: Tue Oct 07 2025 - 13:21:28 EST
On 10/7/25 1:18 PM, Oleg Nesterov wrote:
On 10/07, Waiman Long wrote:
On 10/7/25 10:21 AM, Oleg Nesterov wrote:OK, I will add "__", but I thought that "internal helper" makes it clear that
+I would suggest adding the "__" prefix to indicate that this is an internal
+/* internal helper for scoped_seqlock_read/scoped_seqlock_read_irqsave */
+static inline int
+scoped_seqlock_read_retry(seqlock_t *lock, int *seq, unsigned long *flags)
helper that shouldn't be called directly.
it shouldn't be called directly. Nevermind, will do.
Again, will do. See my reply to Linus.+#define __scoped_seqlock_read(lock, lockless, seq) \I like Linus' suggestion of putting lockless and seq into a struct to make
+ for (int lockless = 1, seq = read_seqbegin(lock); \
+ lockless || scoped_seqlock_read_retry(lock, &seq, NULL); \
+ lockless = 0)
it more consistent with __scoped_seqlock_read_irqsave().
Hmm... This is what the comment above tries to say... Do you think it can+/**Maybe we should we should add a comment saying that this API is similar to
+ * scoped_seqlock_read_irqsave(lock) - same as scoped_seqlock_read() but
+ * disables irqs on a locking pass
+ * @lock: pointer to the seqlock_t protecting the data
scoped_seqlock_read() but with irqs disabled.
be improved?
Sorry, I missed that. Never mind :-)
Cheers,
Longman