bufmgr: Make UnlockReleaseBuffer() more efficient

Andres Freund <andres@anarazel.de>

Commit: f39cb8c011062d65e146c1e9d1aae221e96d8320
Author: Andres Freund <andres@anarazel.de>
Date: 2026-03-27T19:56:29Z
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@gmail.com>
Discussion: https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d

Files

PathChange+/−
src/backend/storage/buffer/bufmgr.c modified +55 −3

Discussion