Re: Improve LWLock tranche name visibility across backends - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Improve LWLock tranche name visibility across backends
Date
Msg-id aLVzBrTp731FTw0l@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Improve LWLock tranche name visibility across backends  (Nathan Bossart <nathandbossart@gmail.com>)
Responses Re: Improve LWLock tranche name visibility across backends
List 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

pgsql-hackers by date:

Previous
From: Jim Jones
Date:
Subject: Re: COPY TO: provide hint when WHERE clause is used
Next
From: Florents Tselai
Date:
Subject: Re: split func.sgml to separated individual sgml files