sequence lock in Linux

From: Mathieu Desnoyers
Date: Fri Jun 11 2010 - 15:40:24 EST

Hi Paul,

(CCing lkml)

Is it just me, or the following code:

static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
unsigned ret;

ret = sl->sequence;
if (unlikely(ret & 1)) {
goto repeat;

return ret;

could use a ACCESS_ONCE() around the sl->sequence read ? I'm concerned about the
compiler generating code that reads the sequence number chunkwise.

The same apply to all other reads of the sequence number in seqlock.h (including
the retry code).

Thoughts ?


Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at