mirror of https://github.com/torvalds/linux.git
The comments and pseudo code in Documentation/locking/seqlock.rst are wrong:
int seq = 0;
do {
read_seqbegin_or_lock(&foo_seqlock, &seq);
/* ... [[read-side critical section]] ... */
} while (need_seqretry(&foo_seqlock, seq));
read_seqbegin_or_lock() always returns with an even "seq" and need_seqretry()
doesn't change this counter. This means that seq is always even and thus the
locking pass is simply impossible.
IOW, "_or_lock" has no effect and this code doesn't differ from
do {
seq = read_seqbegin(&foo_seqlock);
/* ... [[read-side critical section]] ... */
} while (read_seqretry(&foo_seqlock, seq));
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||
|---|---|---|
| .. | ||
| futex-requeue-pi.rst | ||
| hwspinlock.rst | ||
| index.rst | ||
| lockdep-design.rst | ||
| lockstat.rst | ||
| locktorture.rst | ||
| locktypes.rst | ||
| mutex-design.rst | ||
| percpu-rw-semaphore.rst | ||
| pi-futex.rst | ||
| preempt-locking.rst | ||
| robust-futex-ABI.rst | ||
| robust-futexes.rst | ||
| rt-mutex-design.rst | ||
| rt-mutex.rst | ||
| seqlock.rst | ||
| spinlocks.rst | ||
| ww-mutex-design.rst | ||