Re: Improve LWLock tranche name visibility across backends

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Sami Imseih <samimseih(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, 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-09-01 10:18:46
Message-ID: aLVzBrTp731FTw0l@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sat, Aug 30, 2025 at 09:14:46AM -0500, Nathan Bossart wrote:
> On Fri, Aug 29, 2025 at 09:51:38PM -0500, Nathan Bossart wrote:
> > I've also attached a rebased patch that addresses all the latest feedback.
> > A reworked verison of the test patch is also included, but that's mostly
> > intended for CI purposes and is still not intended for commit (yet).
>
> And here's an attempt at fixing the alignment problems revealed by cfbot.

Indeed:

==24409==Using libbacktrace symbolizer.
../src/backend/storage/lmgr/lwlock.c:441:31: runtime error: store to misaligned address 0x7f7644188904 for type 'char *', which requires 8 byte alignment

Changes look good.

Not directly related, but I think that we can get rid of:

size = add_size(size, LWLOCK_PADDED_SIZE);

in LWLockShmemSize() and of:

ptr += LWLOCK_PADDED_SIZE - ((uintptr_t) ptr) % LWLOCK_PADDED_SIZE;

in CreateLWLocks(), and just make use of CACHELINEALIGN().

Attached, a patch doing so. It applies on top of your v20.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v20-0003-Make-use-of-CACHELINEALIGN-in-LWLockShmemSize-an.txt text/plain 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florents Tselai 2025-09-01 10:35:12 Re: split func.sgml to separated individual sgml files
Previous Message Jim Jones 2025-09-01 10:12:57 Re: COPY TO: provide hint when WHERE clause is used