public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* sequence lock in Linux
@ 2010-06-11 19:40 Mathieu Desnoyers
  2010-06-11 20:07 ` Paul E. McKenney
  2010-06-11 20:07 ` Linus Torvalds
  0 siblings, 2 replies; 11+ messages in thread
From: Mathieu Desnoyers @ 2010-06-11 19:40 UTC (permalink / raw)
  To: paulmck; +Cc: linux-kernel

Hi Paul,

(CCing lkml)

Is it just me, or the following code:

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

repeat:
        ret = sl->sequence;
        smp_rmb();
        if (unlikely(ret & 1)) {
                cpu_relax();
                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

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-06-11 22:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-11 19:40 sequence lock in Linux Mathieu Desnoyers
2010-06-11 20:07 ` Paul E. McKenney
2010-06-11 20:46   ` Mathieu Desnoyers
2010-06-11 20:07 ` Linus Torvalds
2010-06-11 20:36   ` Paul E. McKenney
2010-06-11 21:06     ` H. Peter Anvin
2010-06-11 21:36       ` Paul E. McKenney
2010-06-11 21:38         ` H. Peter Anvin
2010-06-11 22:04           ` Paul E. McKenney
2010-06-11 22:41             ` H. Peter Anvin
2010-06-11 21:09   ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox