Re: Move PinBuffer and UnpinBuffer to atomics
От | Alexander Korotkov |
---|---|
Тема | Re: Move PinBuffer and UnpinBuffer to atomics |
Дата | |
Msg-id | CAPpHfdsT_krdbbELv28G=aNGKprxhA8Dvjw5axat=3+6DKwUzA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Move PinBuffer and UnpinBuffer to atomics (Andres Freund <andres@anarazel.de>) |
Ответы |
Re: Move PinBuffer and UnpinBuffer to atomics
|
Список | pgsql-hackers |
On Thu, Apr 7, 2016 at 4:41 PM, Andres Freund <andres@anarazel.de> wrote:
On 2016-03-31 20:21:02 +0300, Alexander Korotkov wrote:
> ! BEGIN_BUFSTATE_CAS_LOOP(bufHdr);
>
> ! Assert(BUF_STATE_GET_REFCOUNT(state) > 0);
> ! wasDirty = (state & BM_DIRTY) ? true : false;
> ! state |= BM_DIRTY | BM_JUST_DIRTIED;
> ! if (state == oldstate)
> ! break;
I'm doubtful that this early exit is entirely safe. None of the
preceding operations imply a memory barrier. The buffer could previously
have been marked dirty, but cleaned since. It's pretty critical that we
re-set the dirty bit (there's no danger of loosing it with a barrier,
because we hold an exclusive content lock).
Oh, I get it.
Practically the risk seems fairly low, because acquiring the exclusive
content lock will have implied a barrier. But it seems unlikely to have
a measurable performance effect to me, so I'd rather not add the early
exit.
Ok, let's just remove it.
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
В списке pgsql-hackers по дате отправления: