Re: Improve LWLock tranche name visibility across backends

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Improve LWLock tranche name visibility across backends
Date: 2025-08-25 21:59:41
Message-ID: CAA5RZ0vWh2uxG99iUb3P4nsoDLk0x7Yuai83AbbGs3YZvJM8QQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Mon, Aug 25, 2025 at 04:37:21PM -0500, Sami Imseih wrote:
> > When we lookup from shared array only, we need to take a shared lock
> > every lookup. Acquiring that lock is what I am trying to avoid. You
> > are saying it's not worth optimizing that part, correct?
>
> Why do we need a shared lock here? IIUC there's no chance that existing
> entries will change. We'll only ever add new ones to the end.

hmm, can we really avoid a shared lock when reading from shared memory?
considering access for both reads and writes can be concurrent to shared
memory. We are also taking an exclusive lock when writing a new tranche.

--
Sami

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-08-25 22:21:37 Re: Support getrandom() for pg_strong_random() source
Previous Message Nathan Bossart 2025-08-25 21:44:55 Re: Improve LWLock tranche name visibility across backends