Re: [PATCH] ipc/sem.c: Update/correct memory barriers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/28, Peter Zijlstra wrote:
>
> On Sat, Feb 28, 2015 at 09:36:15PM +0100, Manfred Spraul wrote:
> > +/*
> > + * Place this after a control barrier (such as e.g. a spin_unlock_wait())
> > + * to ensure that reads cannot be moved ahead of the control_barrier.
> > + * Writes do not need a barrier, they are not speculated and thus cannot
> > + * pass the control barrier.
> > + */
> > +#ifndef smp_mb__after_control_barrier
> > +#define smp_mb__after_control_barrier()	smp_rmb()
> > +#endif
>
> Sorry to go bike shedding again; but should we call this:
>
> smp_acquire__after_control_barrier() ?
>
> The thing is; its not a full MB because:
>
>  - stores might actually creep into it; while the control dependency
>    guarantees stores will not creep out, nothing is stopping them from
>    getting in;
>
>  - its not transitive, and our MB is defined to be so.

I agree, so perhaps it should be named smp_acquire_after_unlock_wait ?
even if it is actually stronger than "acquire"...

To me "control_barrier" looks a bit confusing. I think this helper should
be only used after spin_unlock_wait() or spin_is_locked/unlocked(). In this
case it is clear that this "barrier" pairs with release semantics of
spin_unlock(). And we use it because we want to serialize with that unlock,
as if we are taking this lock.

But I won't insist.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]