Re: Linus rollup

Andrea Arcangeli
2003-01-30T01:35:22Z

On Wed, Jan 29, 2003 at 05:27:43PM -0800, Andrew Morton wrote:
> @@ -82,11 +85,12 @@ static inline int fr_write_trylock(frloc
>
> if (ret) {
> ++rw->pre_sequence;
> - wmb();
> + mb();
> }

this isn't needed

if we hold the spinlock, the serialized memory can't be change under us,
so there's no need to put a read barrier, we only care that pre_sequence
is visible before the chagnes are visible and before post_sequence is
visible, hence only wmb() (after spin_lock and pre_sequence++) is
needed there and only rmb() is needed in the read-side.

Andrea