LWLocks in DSM memory

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: LWLocks in DSM memory
Date: 2016-07-23 13:10:04
Message-ID: CAEepm=3+0pVfi0NisEJndj_SBYcA_xYPgWBikqRQVm+s68GA3w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
lwlocks-in-dsm.patch application/octet-stream 6.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton Dignös 2016-07-23 13:37:38 Re: [PROPOSAL] Temporal query processing with range types
Previous Message Amit Kapila 2016-07-23 12:25:06 Re: AdvanceXLInsertBuffer vs. WAL segment compressibility