From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use UnlockReleaseBuffer() in more places
Date: Fri, 27 Mar 2026 19:58:51 +0000
Message-ID: <E1w6DKV-001k11-08@gemulon.postgresql.org> (raw)
Use UnlockReleaseBuffer() in more places
An upcoming commit will make UnlockReleaseBuffer() considerably faster and
more scalable than doing LockBuffer(BUFFER_LOCK_UNLOCK); ReleaseBuffer();. But
it's a small performance benefit even as-is.
Most of the callsites changed in this patch are not performance sensitive,
however some, like the nbtree ones, are in critical paths.
This patch changes all the easily convertible places over to
UnlockReleaseBuffer() mainly because I needed to check all of them anyway, and
reducing cases where the operations are done separately makes the checking
easier.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/8df3c48e466cfe8a1f9ccd3fb367244d4a47e94a
Modified Files
--------------
contrib/amcheck/verify_gin.c | 6 ++----
contrib/pageinspect/rawpage.c | 3 +--
src/backend/access/heap/heapam.c | 6 ++----
src/backend/access/heap/hio.c | 7 ++++---
src/backend/access/nbtree/nbtpage.c | 35 +++++++++++++++++++++++++------
src/backend/storage/buffer/bufmgr.c | 3 +--
src/backend/storage/freespace/freespace.c | 3 +--
src/test/modules/test_aio/test_aio.c | 7 ++-----
8 files changed, 42 insertions(+), 28 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Use UnlockReleaseBuffer() in more places
In-Reply-To: <E1w6DKV-001k11-08@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox