pgsql: bufmgr: Make UnlockReleaseBuffer() more efficient

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: bufmgr: Make UnlockReleaseBuffer() more efficient
Date: 2026-03-27 19:58:51
Message-ID: E1w6DKV-001k14-0A@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

bufmgr: Make UnlockReleaseBuffer() more efficient

Now that the buffer content lock is implemented as part of BufferDesc.state,
releasing the lock and unpinning the buffer can be implemented as a single
atomic operation.

This improves workloads that have heavy contention on a small number of
buffers substantially, I e.g., see a ~20% improvement for pipelined readonly
pgbench on an older two socket machine.

Reviewed-by: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f39cb8c011062d65e146c1e9d1aae221e96d8320

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 58 +++++++++++++++++++++++++++++++++++--
1 file changed, 55 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-03-27 21:41:19 pgsql: Doc: split functions-posix-regexp section into multiple subsecti
Previous Message Tom Lane 2026-03-27 19:39:04 pgsql: pgindent: ensure all C files end with a newline.