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

From: Oleg Nesterov
Date: Wed Aug 12 2015 - 09:33:46 EST


On 08/09, Manfred Spraul wrote:
>
> /*
> + * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they
> + * are only control barriers.
> + * The code must pair with spin_unlock(&sem->lock) or
> + * spin_unlock(&sem_perm.lock), thus just the control barrier is insufficient.
> + *
> + * smp_rmb() is sufficient, as writes cannot pass the control barrier.
> + */
> +#define ipc_smp_acquire__after_spin_is_unlocked() smp_rmb()

Agreed.



But to remind, this can have more users. In particular, task_work_run()
which currently does mb() after spin_unlock_wait().

Can someone suggest a good "generic" name for this helper so that we can
move it into include/linux/spinlock.h?

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/