>> Instead, I suggest modifying BgBufferSync, specifically this part right
>> here:
>>
>> else if (buffer_state & BUF_REUSABLE)
>> reusable_buffers++;
>>
>> What I would suggest is that if the BUF_REUSABLE flag is set here, use
>> that as the trigger to do StrategyMoveBufferToFreeListEnd().
>
> I think at this point also we need to lock buffer header to check refcount
> and usage_count before moving to freelist, or do you think it is not
> required?
If BUF_REUSABLE is set, that means we just did exactly what you're
saying. Why do it twice?
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company