[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1404211002080.1201-100000@iolanthe.rowland.org>
Date: Mon, 21 Apr 2014 10:03:16 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Oliver Neukum <oliver@...kum.org>
cc: linux-kernel@...r.kernel.org
Subject: Re: question on read_barrier_depends
On Mon, 21 Apr 2014, Oliver Neukum wrote:
> > In addition, the following code in kfifo_get() does this:
> >
> > *(typeof(__tmp->type))__val = \
> > (__is_kfifo_ptr(__tmp) ? \
> > ((typeof(__tmp->type))__kfifo->data) : \
> > (__tmp->buf) \
> > )[__kfifo->out & __tmp->kfifo.mask]; \
> > smp_wmb(); \
> > __kfifo->out++; \
> >
> > It looks like the smp_wmb() should really be smp_mb(), because it
> > separates the _read_ for val from the _write_ of kfifo->out.
>
> On the third hand, I now think wmb() is sufficient, because
> there's also a write to __val. It does depend on the read
> of buf[out & mask], but if no CPU does speculative writes
> it must be correct.
You are right; I missed that. Good point.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists