Re: Behaviour of smp_mb__{before,after}_spin* and acquire/release

From: Oleg Nesterov
Date: Tue Jan 13 2015 - 13:46:53 EST


On 01/13, Will Deacon wrote:
>
> 1. Does smp_mb__before_spinlock actually have to order prior loads
> against later loads and stores? Documentation/memory-barriers.txt
> says it does, but that doesn't match the comment

The comment says that smp_mb__before_spinlock() + spin_lock() should
only serialize STOREs with LOADs. This is because it was added to ensure
that the setting of condition can't race with ->state check in ttwu().

But since we use wmb() it obviously serializes STOREs with STORES. I do
not know if this should be documented, but we already have another user
which seems to rely on this fact: set_tlb_flush_pending().

As for "prior loads", this doesn't look true...

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/