LWLocks in DSM memory - Mailing list pgsql-hackers

From Thomas Munro
Subject LWLocks in DSM memory
Date
Msg-id CAEepm=3+0pVfi0NisEJndj_SBYcA_xYPgWBikqRQVm+s68GA3w@mail.gmail.com
Whole thread Raw
Responses Re: LWLocks in DSM memory  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers
Hi,

As already noted[1], LWLocks don't currently work in DSM segments,
because they use dlist for the list of waiters.  Even though all of
the waiter nodes are in PGPROC and therefore have stable addresses,
the dlist code internally constructs a circular list including
pointers to a special sentinel node inside the dlist_head object, and
those pointers may be invalid in other backends.

One solution could be to provide a non-circular variant of the dlist
interface that uses NULL list termination.  I've attached a quick
sketch of something like that which seems to work correctly.  It is
only lightly tested so far and probably buggy, but shows the general
idea.

Any thoughts on this approach, or better ways to solve this problem?
How valuable is the branch-free property of the circular push and
delete operations?

[1] https://www.postgresql.org/message-id/CA+Tgmobjia49CCJ0ZazbWaVv7nKgYt+1Zo5CwxkH9Aahgn2vPg@mail.gmail.com

--
Thomas Munro
http://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: AdvanceXLInsertBuffer vs. WAL segment compressibility
Next
From: Anton Dignös
Date:
Subject: Re: [PROPOSAL] Temporal query processing with range types