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

From: Oleg Nesterov
Date: Sun Mar 01 2015 - 14:19:04 EST


I leave this to you and Paul/Peter, but...

On 03/01, Manfred Spraul wrote:
> +/*
> + * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they
> + * are only control barriers, thus a memory barrier is required if the
> + * operation should act as an acquire memory barrier, i.e. if it should
> + * pair with the release memory barrier from the spin_unlock() that released
> + * the spinlock.
> + * smp_rmb() is sufficient, as writes cannot pass the implicit control barrier.
> + */
> +#ifndef smp_acquire__after_spin_unlock_wait
> +#define smp_acquire__after_spin_unlock_wait() smp_rmb()
> +#endif
> +#ifndef smp_acquire__after_spin_is_unlocked
> +#define smp_acquire__after_spin_is_unlocked() smp_rmb()
> +#endif

But spin_unlock_wait() and spin_is_locked() is the "same thing" when it
comes to serialization with spin_unlock()... Not sure we need 2 helpers.

But I won't argue of course.


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