diff options
| author | Oleg Nesterov <oleg@redhat.com> | 2025-09-28 18:20:29 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2025-10-21 12:31:56 +0200 |
| commit | 28a0ee311960baad97bf85e1e995aed4a71e22a2 (patch) | |
| tree | fadecc4815fde6027e94fc75f89619ad6cf597ed /rust/kernel/debugfs/traits.rs | |
| parent | 44472d1b83127e579c798ff92a07ae86d98b61b9 (diff) | |
documentation: seqlock: fix the wrong documentation of read_seqbegin_or_lock/need_seqretry
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>
Diffstat (limited to 'rust/kernel/debugfs/traits.rs')
0 files changed, 0 insertions, 0 deletions