Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pg6v7-0003I7-EY for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Mar 2023 16:39:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pg6v6-0004oH-0z for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Mar 2023 16:39:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pg6v5-0004o7-OJ for pgsql-hackers@lists.postgresql.org; Sat, 25 Mar 2023 16:39:07 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pg6v3-00015P-Fw for pgsql-hackers@postgresql.org; Sat, 25 Mar 2023 16:39:06 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D92785C011B; Sat, 25 Mar 2023 12:39:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sat, 25 Mar 2023 12:39:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1679762344; x=1679848744; bh=8W VuyDiAwmDV9IXSXwTFKntt6HfBuIacPC1pj9x3pxw=; b=NhHVNeNFHH9bV4p+uj 8gSqBT0DIDxUKZJLz+NHqP3yKooF/CNF9NKWDM9Qa3978jWR9nz/KNlavkTFurTR fU4XkCNO+RByRFpFnuwhKa4FmT7mmYPb1qhbhF8H3vTVV5uryARwthjUqyeSlOIC KerT5dinm7WlNQ4nT242m/dzHf2qElP3kJ4pD4u7uZQJwyz347ep4cyOfzkbmtsV 6fL5wf49VZ6bmGaa6YAXuTcOyb3Vs6G4BIkVnTbBi8FuhgRBN6ygdJ4XyKhq8Scm XbHkz7fzMGNbnAeLvXoZJP5RcDzLbEGt5ZOyuXyKWZGPGrseS2IXPA2tseVjXR59 0qRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1679762344; x=1679848744; bh=8WVuyDiAwmDV9 IXSXwTFKntt6HfBuIacPC1pj9x3pxw=; b=nHe3axn+zaOgekjDrjwODGIkeERvB hY/rtCt+V3ySoksXOHLZdqP0nLLIBB9kXnTcFLGeQm7pIieyMfgz++3obWn79ghi RJ+lG8vHRoHN5RgcrQkNZ42ThLT+1fSGexn12uZcNO5hNNaGALSXWmijCw5AzyXY Xh/yPokp0qo9dqhbes6MHwxYgXlMun0FXNh9m7wZHuNAUsQv2vkEfxN1XV8mWibt ppWPeaSynd6AmFIpIJQt2lL/Ty8KPi21LadQtF4yeXJmE+XrdZ/LJF1Z+QOAmUBL mJYLFy6qB8VQpu20Z07YD8CdazZZVRBXR93VPA32cSz7RSY5CPbUhFSaA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdegkedgleefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 25 Mar 2023 12:39:04 -0400 (EDT) Date: Sat, 25 Mar 2023 09:39:03 -0700 From: Andres Freund To: Tomas Vondra Cc: pgsql-hackers@postgresql.org, Tomas Vondra , Anastasia Lubennikova , Pavan Deolasee , Jeff Janes Subject: Re: hio.c does visibilitymap_pin()/IO while holding buffer lock Message-ID: <20230325163903.eu67kqcqo4llhc4u@awork3.anarazel.de> References: <20230325025740.wzvchp2kromw4zqz@awork3.anarazel.de> <0c11032a-d91b-8875-ab7b-4554776390c5@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0c11032a-d91b-8875-ab7b-4554776390c5@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2023-03-25 14:34:25 +0100, Tomas Vondra wrote: > On 3/25/23 03:57, Andres Freund wrote: > > 2) Change relevant code so that we only return a valid vmbuffer if we could do > > so without blocking / IO and, obviously, skip updating the VM if we > > couldn't get the buffer. > > > > I don't recall the exact details about the vm locking/pinning, but can't > we just ensure we actually follow the proper locking order? I mean, this > only deals with new pages, requested at line ~624: > > buffer = ReadBufferBI(relation, P_NEW, RBM_ZERO_AND_LOCK, bistate); > > Can't we ensure we actually lock the vm buffer too in ReadBufferBI, > before calling ReadBufferExtended? Or am I confused and that's not > possible for some reason? Note that this is using P_NEW. I.e. we don't know the buffer location yet. Greetings, Andres Freund