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 1vQb23-00CH5U-0s for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Dec 2025 00:47:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQb21-00AjKh-2f for pgsql-hackers@arkaria.postgresql.org; Wed, 03 Dec 2025 00:47:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQb20-00AjKY-2q for pgsql-hackers@lists.postgresql.org; Wed, 03 Dec 2025 00:47:45 +0000 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQb1u-002pYV-0t for pgsql-hackers@postgresql.org; Wed, 03 Dec 2025 00:47:44 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 4BE2EEC0573; Tue, 2 Dec 2025 19:47:36 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Tue, 02 Dec 2025 19:47:36 -0500 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:subject :subject:to:to; s=fm1; t=1764722856; x=1764809256; bh=d37gMlkSH9 2bSOx44Tlaf7MZ3Fm48Joj5umJPuRfDtY=; b=jgDudegMfC8C2U8WiF5ueQFV9R GB4dj0a60CID5OpNGc3U67Hnz9K6CdhtwL4zR09hq3IgfNQzd6o6oK1dGEtE41hO YxSGcFknYRRhxw1KKxLG1Q3u8z6muq6XB2bRNrxcHqIetluA9w2mBO3yflzIYajV W6FnOY2zGu3j/bhCNi+YIzdd0chGx93T1m6NrqTgGmcbfLdn3Zpui5QWkNZZnsMd cmw/JuUzCXJAd2GOzIm4Yp/VbgABUafLEVTQPYnnSLmlaVbaZM4wNYGVzPqs9ca7 jY6/RmJDqBlWGUJGHA4XwocLlH/dPSO/SLPEKolM6vdNbDeqjj28At2BAUjg== 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:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1764722856; x=1764809256; bh=d37gMlkSH92bSOx44Tlaf7MZ3Fm48Joj5um JPuRfDtY=; b=NvzNFkuCqgiBblWXHak3a04Rvlzd8sdlfAZ//MOQEDcC0yowDy2 4NV/nSfN2WYSzgjsC2YzFGYKeZef6MBK4KMIJ6a11P7AOU59+/VFsjY2yXm69Awf fj5sldhvP9Aa0oq0PiDU7pGInhcjCNJLJ2LswpV/EjPykmHjJKgWMK1dKe0aJiok cCawcNPLKWA6lkwQXpBc113yvafv0/yetEEqPPPxfnMRxUCuZLEjFmBFoXXCQTno /kL7sKBOJhnSpX11WQFu2eNdF8dlHiFQFGek3Dh8ZRNTBqucNBptgoXD2rdOPWS5 ixUdZyzN/i+RJZhm2+7TMJnh7RISV0n7M3g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduhedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh epfffhvfevuffkfhggtggujgesmhdtsfertddtvdenucfhrhhomheptehnughrvghsucfh rhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrthhtvg hrnhepfeefudejgffghfegheduffduieejgedtkeejhfevieevgeekgeekleeljeefkeei necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghnug hrvghssegrnhgrrhgriigvlhdruggvpdhnsggprhgtphhtthhopeekpdhmohguvgepshhm thhpohhuthdprhgtphhtthhopegsohgvkhgvfihurhhmodhpohhsthhgrhgvshesghhmrg hilhdrtghomhdprhgtphhtthhopehmvghlrghnihgvphhlrghgvghmrghnsehgmhgrihhl rdgtohhmpdhrtghpthhtohepmhhitghhrggvlhdrphgrqhhuihgvrhesghhmrghilhdrtg homhdprhgtphhtthhopehrohgsvghrthhmhhgrrghssehgmhgrihhlrdgtohhmpdhrtghp thhtohepthhhohhmrghsrdhmuhhnrhhosehgmhgrihhlrdgtohhmpdhrtghpthhtohephh hlihhnnhgrkhgrsehikhhirdhfihdprhgtphhtthhopehnohgrhheslhgvrggusghorght rdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqh hlrdhorhhg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 2 Dec 2025 19:47:35 -0500 (EST) Date: Tue, 2 Dec 2025 19:47:35 -0500 From: Andres Freund To: Melanie Plageman Cc: Matthias van de Meent , pgsql-hackers@postgresql.org, Thomas Munro , Heikki Linnakangas , Noah Misch , Robert Haas , Michael Paquier Subject: Re: Buffer locking is special (hints, checksums, AIO writes) Message-ID: References: <6kmid26do57ykqfpvq6iieniy4djsymhrypkjccazq5g4bbe6a@2y6owwv7qpex> <3je3ahgf7rrmmurxo6hnlhg5d3ffwfrtjwjxd6jm5srlv5iebp@vxqk5qtgmowr> <3w7v3w6a57jnssokap4k7thoekig72flnyhd4wp3yftzdd7lm7@f6lpcfen6hr7> <6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar> <3nce7i72ayzkunai6mkz24ckbxk74jodz4ua2chcdrwppxlxcd@w6x5kfkjrkru> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="kad4mm4awdo7v2ki" Content-Disposition: inline In-Reply-To: <3nce7i72ayzkunai6mkz24ckbxk74jodz4ua2chcdrwppxlxcd@w6x5kfkjrkru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --kad4mm4awdo7v2ki Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On 2025-11-25 11:54:00 -0500, Andres Freund wrote: > Thanks a lot for that detailed review! A few questions and comments, before I > try to address the comments in the next version. Here's that new new version, with the following changes - Some more micro-optimizations, most importantly adding a commit that doesn't initialize the delay in LockBufHdr() unless needed. With those I don't see a consistent slowdown anymore (slight speedup on one workstation, slight slowdown on another, in an absurdly adverse workload) - Tried to address Melanie's feedback, with some exceptions (some noted below, but I also need to make another pass through the reviews) - re-implemented AssertNotCatalogBufferLock() in the new world - Substantially expanded comments around setting hint bits (in buffer/README, heapam_visibility.c and bufmgr.c) - split out the change to fsm_vacuum_page() to start to lock the page into is own commit - reordered patch series so that smaller changes are before the 64bit-state and "Implement buffer content locks independently of" commits, so they can be committed while we finish cleaning the later changes - I didn't invest much in cleaning up the later patches ("Don't copy pages while writing out" and "Make UnlockReleaseBuffer() more efficient") yet, wanted to focus on the earlier patches first Todo: - still need to rename ResOwnerReleaseBufferPin(). Wondering about what to rename ResourceOwnerDesc.name to. "buffer ownership" maybe? Not great... - gistkillitems() complaint by Melanie - amortize vs batch vs SetHintBits comment + SHB_* names - for the next version I'll remove the BATCHMVCC_FEWER_ARGS conditionals from 0010. I don't love needing BatchMVCCState but I don't really see an alternative, the performance difference is pretty persistent. Questions: - ForEachLWLockHeldByMe() and LWLockDisown() aren't used anymore, should we remove them? Greetings, Andres Freund --kad4mm4awdo7v2ki Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v7-0001-bufmgr-Turn-BUFFER_LOCK_-into-an-enum.patch"