Re: Buffer locking is special (hints, checksums, AIO writes)

From: Andres Freund <andres(at)anarazel(dot)de>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)
Date: 2025-12-18 17:03:36
Message-ID: dsbacri4xldlobl3jbqqlksefsyrwj7lzljbohxsbqjus3z4o7@otb6rge4w7az
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-12-18 17:06:19 Re: Serverside SNI support in libpq
Previous Message Tom Lane 2025-12-18 16:57:37 Re: Fixing the btree_gist inet mess