Re: Move PinBuffer and UnpinBuffer to atomics - Mailing list pgsql-hackers

From YUriy Zhuravlev
Subject Re: Move PinBuffer and UnpinBuffer to atomics
Date
Msg-id 1806030.Y4NWmNRp0C@dinodell
Whole thread Raw
In response to Re: Move PinBuffer and UnpinBuffer to atomics  (Andres Freund <andres@anarazel.de>)
Responses Re: Move PinBuffer and UnpinBuffer to atomics  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Tuesday 15 September 2015 04:06:25 Andres Freund wrote:
> And here's an actual implementation of that approach. It's definitely
> work-in-progress and could easily be optimized further. Don't have any
> big machines to play around with right now tho.
Thanks.  Interesting. 
We had a version like your patch. But this is only half the work. Example:
state = pg_atomic_read_u32(&buf->state);
if ((state & BUF_REFCOUNT_MASK) == 0   && (state & BUF_USAGECOUNT_MASK) == 0)
After the first command somebody can change buf->state and local state not 
actual. 
In this embodiment, there is no significant difference between the two 
patches. For honest work will need used the CAS for all IF statement.

Thanks! Hope for understanding. ^_^
-- 
YUriy Zhuravlev
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: Summary of plans to avoid the annoyance of Freezing
Next
From: YUriy Zhuravlev
Date:
Subject: Re: Move PinBuffer and UnpinBuffer to atomics