On 2015-06-29 00:42:53 -0400, Tom Lane wrote:
> #define S_UNLOCK(lock) \
> do { _Asm_sched_fence(); (*(lock)) = 0; } while (0)
Robert, how did you choose that? Isn't _Asm_sched_fence just a compiler
barrier? Shouldn't this be a _Asm_mf()?
> which immediately raises the question of why omitting the "volatile"
> cast is okay.
Should be fine if _Asm_sched_fence() were a proper memory (or een
release) barrier. Which I don't think it is.
> I also wonder if we don't need a second _Asm_sched_fence() after the
> lock release.
Shouldn't be needed - the only thing that could be reordered is the
actual lock release. Which will just impact timing in a minor manner (it
can't move into another locked section).
Greetings,
Andres Freund