Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vubam-00FXX5-0k for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Feb 2026 19:27:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vubak-00EnvJ-2J for pgsql-hackers@arkaria.postgresql.org; Mon, 23 Feb 2026 19:27:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vubak-00EnvB-0y for pgsql-hackers@lists.postgresql.org; Mon, 23 Feb 2026 19:27:38 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vubag-00000000qN1-2F7q for pgsql-hackers@postgresql.org; Mon, 23 Feb 2026 19:27:37 +0000 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-436e8758b91so3216935f8f.0 for ; Mon, 23 Feb 2026 11:27:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771874854; cv=none; d=google.com; s=arc-20240605; b=a2S1PCUWWRgypaHBEVJSc8Ka88Pjkoy5D9yrjtxB/vkj4L4rk6XFjmMrvifzholOuk GDEO+IZ987cxBuD+tpclzDQ2u3vXNc4+lPNLvSo9EBCzw9NKAVoAzZBhatmSr3CcKot4 iQJyJKf/qltHcIi2a8OVDIwZjJdbF9cR12yeuEQA9MKzN1rPSKMqaFzvfbOg+KIyCOE7 3Nui3c0XGPANZVk9uYn/z/t0dyoH2+OzeKjC9hCgf7pop5smpGNNvuQLUTgVu+1kqCnq JZyS3dZqmjwIbOFVAg15mRw+F3j6vWRHDBWZTiv5NfcY/4PpsbEGKxI4RR/C30OQkKyL n5FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8oPcDWkMIPLdCY0RLRQ9fz+RToibaY+hCZdpb21v2VI=; fh=R16uCRs/STesgR89kD/8t/SOFkPDmfQl7T4qEbwCw1o=; b=MgXBdEcTZjIjOXaU3GKHDOv8PQeAY1YGYTZiEYJEfuRExrB8732zE8DC83RhFQqvJG Ky/ElG2F8r4piVKzcKeD7Yu/U6zpfMiH144mGwlqm27o6EpUADxXK4zFiUxesp30JEq4 TyWH2Zvv/WXICWPMPjgi8utq0XyJ7SYPSvX2irpwmTnj+e1GxDad3O6Xgc7nX3WTImjF zNaLlX5xuyTvaYTycAzZJTNdXn45y9AFTMQ2L45OKerV7KGym/MeX4gZhnHp3VT6dsO9 9gubP0m+HTWsr6Lo9gZ+Rad+EeJNb9ugjIvoW+1oxMmDUKlBOwgJAZU8FM8UPnEFn4qs I9ug==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20230601.gappssmtp.com; s=20230601; t=1771874854; x=1772479654; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8oPcDWkMIPLdCY0RLRQ9fz+RToibaY+hCZdpb21v2VI=; b=v/IS/nSEsR2J7hgCZTQA4YgRsFrgFKLJxKMKqIQ/vESQootyTpU6wL03S5mtwNyNMP yrh3Wj2RYlrC55J6aRCsBsX9P6XQY7khVHgPiZkjquONHYGCWJaIJAwVrqzNP6fy4F6z +iL3RcPH/R55GKwVrmzy/J+tvOrQJwWvaD/gMwC2g7KrMyRG7f27imOCGj8wEyzy4mOS ALeljR492wJ3f0eMx/VMwODfaxMS37pnIWncD5izjNx9ZEWC4Lg8hYFrbJ1clG82K/aw ToKSZgTiw5L3I+WAy+mt3nxWEidKx/SrJtQIGkKChiXlutTmZs9XNQNNzPeKSv3JraBX WflQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771874854; x=1772479654; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8oPcDWkMIPLdCY0RLRQ9fz+RToibaY+hCZdpb21v2VI=; b=PnlCI5kvTQqq+YgpB5hF8b99Fhnd446IkrJYQftxVRyKm02ci8ZyMk8ROScdLbkpIj LQyAeyiWUtwgp6nI0dY9qMIkwvBc+VnJ0uCvKQfQTT/oSiU4aL5TZIng6Pu6LnTcTKDw 3cKCmFvrBdQCWxJmqlhGnNbSpL8fyZyIA/sYCDC0jVyjq03Rql+1snHUiHX7bhWP9yDk tCIEF0+ANPx3m6qdjBfvH2kKaycHu0GOUZRkANlnZUOsz+7FN3J9N8lHznOVQ7mPS4RK r1Dp3l5taHMDw888JHbbigE97SLFBG/C1FdDSPcPkK8hf3M3cFkRZQ/qxLFIG56MaHpa c5YA== X-Forwarded-Encrypted: i=1; AJvYcCXOmnwwsssTiVVDUF3PRYSpyhPb3cUuyXbh972MmYTy5vj1hVjBKPXE3dOPStYOTstPbDu2vd0z9r/DnO6V@postgresql.org X-Gm-Message-State: AOJu0Yx1O4KGGTh8RVGF+wtdjoZg3I4SxOFh3ZzYIazqRBKxSvgLqGW4 wLpDKbxmxUtWGSdi/lAHEEh+bSKUoEo7MIQvh+K9fDtCaiYeQtNlGQa5HgQ2KlZ+TsRmRnDWmLe GaZBkNAeraZNTSEK15C+8BnJo1rrH0jTAj8Q2NFuCLg== X-Gm-Gg: ATEYQzyWZnv+Y5EaoO6jzbJb8pbDfVy92qvbzTr1TcATQl1Dawv2xTNqUi4629GBNx1 w9Tos8XKMUNvqdmD8GHJo4h60AlaE4uEBOY+ZTmVWY/IkOWmqEozR2+Tzk1LvuCN+eHeypXx4dy //Iu9NKS9EtqK6+IMUw8zgpmDSFJMW1JLFlChXYSk6zkli9UYUOtzJ6p/3YNsMza/+XtQwyZluA ED4WqCw11u4dCNHpm0VnAmAObR5copERScG88cchA3oYT1BZDEhMrnEZJsLK+KgfRvoHxTYWPEK BoiO0iU= X-Received: by 2002:a05:6000:402b:b0:432:5bf9:cf15 with SMTP id ffacd0b85a97d-4396f153396mr17349730f8f.5.1771874853781; Mon, 23 Feb 2026 11:27:33 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Peter Geoghegan Date: Mon, 23 Feb 2026 14:27:07 -0500 X-Gm-Features: AaiRm515nh8y0UrV5ZgzERPElYM4MytelBod30_axvggmgIhjfPeuPOaEMaXQRg Message-ID: Subject: Re: Don't synchronously wait for already-in-progress IO in read stream To: Melanie Plageman Cc: Thomas Munro , Andres Freund , pgsql-hackers@postgresql.org, Tomas Vondra Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jan 23, 2026 at 4:04=E2=80=AFPM Melanie Plageman wrote: > Attached v3 basically does what you suggested above. Now, we should > only have to wait if the backend encounters a buffer after another > backend has set BM_IO_IN_PROGRESS but before that other backend has > set the buffer descriptor's wait reference. Have you considered making ProcessBufferHit into an inline function? I find that doing so meaningfully improves performance with the index prefetching patch set. This is particularly true for cached index-only scans with many VM buffer hits. And it seems to have no downside. Right now, without any inlining, running perf against a backend that executes such an index-only scan shows the function/symbol "ProcessBufferHit.isra.0" as very hot. Apparently gcc does this isra business ("Interprocedural Scalar Replacement of Aggregates") as an optimization. Instead of passing the whole struct or pointer, the caller is rewritten to extract just the necessary scalar values (like an int or a bool) and pass those directly in registers. But we seem to be better off fully inlining the function. -- Peter Geoghegan