Re: better atomics - v0.5

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: better atomics - v0.5
Дата
Msg-id CA+TgmoZjAiqjg40364uSkyh8c7iib_VbvsTDuwG2d-rX8p1BeA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: better atomics - v0.5  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: better atomics - v0.5
Re: better atomics - v0.5
Список pgsql-hackers
On Thu, Jun 26, 2014 at 3:04 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> I don't really see usecases where it's not related data that's being
> touched, but: The point is that the fastpath (not using a spinlock) might
> touch the atomic variable, even while the slowpath has acquired the
> spinlock. So the slowpath can't just use non-atomic operations on the
> atomic variable.
> Imagine something like releasing a buffer pin while somebody else is
> doing something that requires holding the buffer header spinlock.

If the atomic variable can be manipulated without the spinlock under
*any* circumstances, then how is it a good idea to ever manipulate it
with the spinlock?  That seems hard to reason about, and unnecessary.
Critical sections for spinlocks should be short and contain only the
instructions that need protection, and clearly the atomic op is not
one of those.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Atomics hardware support table & supported architectures
Следующее
От: Robert Haas
Дата:
Сообщение: Re: pgaudit - an auditing extension for PostgreSQL