Re: Buffer locking is special (hints, checksums, AIO writes) - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Buffer locking is special (hints, checksums, AIO writes)
Date
Msg-id dsbacri4xldlobl3jbqqlksefsyrwj7lzljbohxsbqjus3z4o7@otb6rge4w7az
Whole thread Raw
In response to Re: Buffer locking is special (hints, checksums, AIO writes)  (Andres Freund <andres@anarazel.de>)
Responses Re: Buffer locking is special (hints, checksums, AIO writes)
List pgsql-hackers
Hi,

On 2025-12-17 09:54:32 -0500, Andres Freund wrote:
> On 2025-12-17 11:25:50 +0200, Heikki Linnakangas wrote:
> > - LWLockWaitListLock() uses pg_atomic_read_u32() after spinning,
> > LockBufHdr() retries directly with pg_atomic_fetch_or_u32().
> 
> I think here LWLockWaitListLock() is likely right - but it seems like a change
> to LockBufHdr() that I would probably make in a separate commit?

FWIW, I couldn't come up with a scenario where it makes a performance
difference - exclusive content locks just aren't *that* frequent. And because
of that the wait list lock doesn't have similar contention as some non-content
lwlocks (like XidGenLock). The most extreme workload I could think of was
pgbench hammering a single sequence across many sessions. While the exclusive
locks show up in wait events, the buffer header spinlock itself doesn't..

So I'm inclined to not change anything about this for now.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fixing the btree_gist inet mess
Next
From: Jacob Champion
Date:
Subject: Re: Serverside SNI support in libpq