Re: pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner. - Mailing list pgsql-committers

From Tom Lane
Subject Re: pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner.
Date
Msg-id 24612.1460991515@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner.  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-committers
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Apr 18, 2016 at 10:27 AM, Andres Freund <andres@anarazel.de> wrote:
>> Personally I think the "spin" part is actually quite relevant, and I
>> think we shouldn't loose it. It describes concurrency and blocking
>> behaviour, and how errors need to be handled (i.e. there may not be
>> any).

> IMHO, "buffer header lock bit" is plenty clear enough.  We could say
> "buffer header spin lock bit" but I think that's too many words and
> not actually more clear.

I agree.  If it's just a bit, it pretty much has to be a spin lock,
because there's no way for it to contain any infrastructure that would
support anything else.  In any case, you could and should document the
exact semantics in a comment associated with the declaration of that
bit field.  It's not really necessary to repeat them in every reference,
so long as the references use a unique name that won't be confused with
other possible locking mechanisms.  (From that standpoint, "header lock
bit" might be actively better than anything including the phrase "spin
lock", since it reduces the chance of confusion with s_lock.h.)

            regards, tom lane


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pgsql: Allow Pin/UnpinBuffer to operate in a lockfree manner.
Next
From: Tom Lane
Date:
Subject: pgsql: Fix --disable-spinlocks in 9.2 and 9.3 branches.