pgsql: bufmgr: Pass io_object and io_context through to PinBufferForBlo

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: bufmgr: Pass io_object and io_context through to PinBufferForBlo
Date: 2026-03-26 16:32:18
Message-ID: E1w5nd3-001ZDy-2Z@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

bufmgr: Pass io_object and io_context through to PinBufferForBlock()

PinBufferForBlock() is always_inline and called in a loop in
StartReadBuffersImpl(). Previously it computed io_context and io_object
internally, which required calling IOContextForStrategy() -- a non-inline
function the compiler cannot prove is side-effect-free. This could potential
cause unneeded redundant function calls.

Compute io_context and io_object in the callers instead, allowing
StartReadBuffersImpl() to do so once before entering the loop.

Author: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Suggested-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv

Branch
------
master

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

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 45 +++++++++++++++++++++++++------------
1 file changed, 31 insertions(+), 14 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2026-03-26 19:06:40 pgsql: Address perlcritic complaint in response to 906a0469728
Previous Message Robert Haas 2026-03-26 16:06:10 pgsql: pg_plan_advice: Refactor to invent pgpa_planner_info