Re: Readme of Buffer Management seems to have wrong sentence - Mailing list pgsql-hackers

From Ants Aasma
Subject Re: Readme of Buffer Management seems to have wrong sentence
Date
Msg-id CA+CSw_tYwZ=N1kg46VhDKHMHT47X9W4sRumVDJQNo_wGRfVNpg@mail.gmail.com
Whole thread Raw
In response to Re: Readme of Buffer Management seems to have wrong sentence  (Ants Aasma <ants@cybertec.at>)
List pgsql-hackers
On Tue, May 22, 2012 at 11:36 PM, Ants Aasma <ants@cybertec.at> wrote:
> ... The free list
> itself is a bit trickier, but if it's still necessary/useful then
> SC->firstFreeBuffer and buf->freeNext are in effect a linked-list
> stack, there should plenty of tested lock free algorithms floating
> around for that. (btw. lastFreeBuffer looks like dead code, is that
> correct?)

Thinking about it a bit more, if the freelist is mostly empty, a
simpler alternative would be to make an unprotected read to check
SC->firstFreeBuffer and only acquire BufFreelistLock if there's
anything to pop. This would reduce the lock free parts to just
atomically incrementing a variable.

Ants Aasma
--
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de


pgsql-hackers by date:

Previous
From: Sergey Koposov
Date:
Subject: Re: 9.2beta1, parallel queries, ReleasePredicateLocks, CheckForSerializableConflictIn in the oprofile
Next
From: Florian Pflug
Date:
Subject: Re: [RFC] Interface of Row Level Security