Skip to content

Commit d3b35b8

Browse files
a-darwishPeter Zijlstra
authored andcommitted
seqlock: seqcount_t latch: End read sections with read_seqcount_retry()
The seqcount_t latch reader example at the raw_write_seqcount_latch() kernel-doc comment ends the latch read section with a manual smp memory barrier and sequence counter comparison. This is technically correct, but it is suboptimal: read_seqcount_retry() already contains the same logic of an smp memory barrier and sequence counter comparison. End the latch read critical section example with read_seqcount_retry(). Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 15cbe67 commit d3b35b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/seqlock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ static inline int raw_read_seqcount_latch(seqcount_t *s)
363363
* idx = seq & 0x01;
364364
* entry = data_query(latch->data[idx], ...);
365365
*
366-
* smp_rmb();
367-
* } while (seq != latch->seq);
366+
* // read_seqcount_retry() includes needed smp_rmb()
367+
* } while (read_seqcount_retry(&latch->seq, seq));
368368
*
369369
* return entry;
370370
* }

0 commit comments

Comments
 (0)