Re: Spinlocks and compiler/memory barriers
От | Andres Freund |
---|---|
Тема | Re: Spinlocks and compiler/memory barriers |
Дата | |
Msg-id | 20140626224026.GE1926@awork2.anarazel.de обсуждение исходный текст |
Ответ на | Spinlocks and compiler/memory barriers (Andres Freund <andres@2ndquadrant.com>) |
Список | pgsql-hackers |
Hi, On 2014-06-26 23:01:10 +0200, Andres Freund wrote: > I think we should rework things so that we fall back to > pg_write_barrier(), (*((volatile slock_t *) (lock)) = 0) instead of what > we have right now. > That'd require to make barrier.h independent from s_lock.h, but I think > that'd be a pretty clear improvement. One open question is what happens > with the SpinlockRelease() when barriers are implemented using spinlocks > and we need a barrier for the SpinlockRelease(). Too tired to think about this any further today. Here's my current state of this: * barrier.h's spinlock implementation moved to s_lock.c, loosing the s_lock.h include. That requires a S_UNLOCK definition which doesn't again use a barrier. I've coined it S_UNLOCKED_UNLOCK * s_lock.h now includes barrier.h to implement the generic S_UNLOCK safely. * gcc x86-64 had a superflous "cc" clobber. Likely copied from the 32bit version which does additional operations. * PPC was missing a compiler barrier * alpha was missing a "cc" clobber. * mips was missing a compiler barrier and a "cc" clobber * I have no idea how to fix pa-risc's S_UNLOCK for !gcc. The referenced spinlock paper calls a external function to avoid reordering. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: