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 1vWHPp-00GUJ7-2R for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Dec 2025 17:03:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vWHPo-0032R0-2A for pgsql-hackers@arkaria.postgresql.org; Thu, 18 Dec 2025 17:03:49 +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 1vWHPo-0032Qs-1B for pgsql-hackers@lists.postgresql.org; Thu, 18 Dec 2025 17:03:49 +0000 Received: from fhigh-a7-smtp.messagingengine.com ([103.168.172.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWHPn-001MTi-1w for pgsql-hackers@postgresql.org; Thu, 18 Dec 2025 17:03:48 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id F33D0140016A; Thu, 18 Dec 2025 12:03:45 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Thu, 18 Dec 2025 12:03:45 -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=1766077425; x=1766163825; bh=dOd2XrpRwK Ch6TkdAYcs8Tb52RtCpQdbYIN0BRFoM4I=; b=PcNL0Ky/vooATDeSdMC2cNZWMI wSyUZAgeHrENscalNSo4DE4yvw1Rs+70/2s6octJPKWKR32HMk/xrWG8Kj6hqWuf zhTQGM6q46p9kNo6PgO0DyyuLsOpaHFYfTV+9EazaqJd9kbNsMlR6BCFl0/Ea5/j c07vw1K1+nTo31wdKtoZb0V8X110CrFAODCggLIYMLhYUPQVguru09c2VGLzOdSl nA9Zp2L6G3Nijr1PVphVCT+Qa9yfxqff8doGLiSCcowlMk/OU4gEAP2Ulw9Ga0Ia 8LZoKShmYpkKzh6f1hb4B2fB2IPeAU26j8ftRdQHuTnw8GtXimvaJ2DKNohQ== 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= 1766077425; x=1766163825; bh=dOd2XrpRwKCh6TkdAYcs8Tb52RtCpQdbYIN 0BRFoM4I=; b=JQQlefjXHZofoMxlsRHhobA8Avzq3jnNtEQkaTCm0EKj6I7tzE4 MEbTpHewxhE0aSXrADVELd2HaV1f7ARuM4E6qI56O1sboaDvkY2bTzzOE/1+nQ/G JORYFif+w7P/BaE10s836pXW+mBFBX/emFu/j65LEQyxVXfyVm+kKBtq/XAABJcL f2yQFddmPQQSGHcPmn71flCLVkp0pmmSvzOIRgm4CbeYiu0UM75XdBKXmICnoqH6 xsjG9KLxmqVZvSDpAGxPyZbsBBKeVFZX5nswGlpJhK9zaoSBqIpThiI+3Ec66CpW Eyb6vL7YxlJJTEP5xPq0Wmzfa19YwOi9Ekw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdegheeljecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecuhfhrohhmpeetnhgurhgvshcu hfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrghtth gvrhhnpeeffffgledvffegtdevlefgtdeggffhvdekgfegteeiveejkeetudelveejhfeu geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnh gurhgvshesrghnrghrrgiivghlrdguvgdpnhgspghrtghpthhtohepkedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepsghovghkvgifuhhrmhdophhoshhtghhrvghssehgmh grihhlrdgtohhmpdhrtghpthhtohepmhgvlhgrnhhivghplhgrghgvmhgrnhesghhmrghi lhdrtghomhdprhgtphhtthhopehmihgthhgrvghlrdhprghquhhivghrsehgmhgrihhlrd gtohhmpdhrtghpthhtoheprhhosggvrhhtmhhhrggrshesghhmrghilhdrtghomhdprhgt phhtthhopehthhhomhgrshdrmhhunhhrohesghhmrghilhdrtghomhdprhgtphhtthhope hhlhhinhhnrghkrgesihhkihdrfhhipdhrtghpthhtohepnhhorghhsehlvggruggsohgr thdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrhgvsh hqlhdrohhrgh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 18 Dec 2025 12:03:44 -0500 (EST) Date: Thu, 18 Dec 2025 12:03:36 -0500 From: Andres Freund To: Heikki Linnakangas Cc: Melanie Plageman , Matthias van de Meent , pgsql-hackers@postgresql.org, Thomas Munro , Noah Misch , Robert Haas , Michael Paquier Subject: Re: Buffer locking is special (hints, checksums, AIO writes) Message-ID: References: <3je3ahgf7rrmmurxo6hnlhg5d3ffwfrtjwjxd6jm5srlv5iebp@vxqk5qtgmowr> <3w7v3w6a57jnssokap4k7thoekig72flnyhd4wp3yftzdd7lm7@f6lpcfen6hr7> <6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar> <3nce7i72ayzkunai6mkz24ckbxk74jodz4ua2chcdrwppxlxcd@w6x5kfkjrkru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2025-12-17 09:54:32 -0500, Andres Freund wrote: > On 2025-12-17 11:25:50 +0200, Heikki Linnakangas wrote: > > - LWLockWaitListLock() uses pg_atomic_read_u32() after spinning, > > LockBufHdr() retries directly with pg_atomic_fetch_or_u32(). > > I think here LWLockWaitListLock() is likely right - but it seems like a change > to LockBufHdr() that I would probably make in a separate commit? FWIW, I couldn't come up with a scenario where it makes a performance difference - exclusive content locks just aren't *that* frequent. And because of that the wait list lock doesn't have similar contention as some non-content lwlocks (like XidGenLock). The most extreme workload I could think of was pgbench hammering a single sequence across many sessions. While the exclusive locks show up in wait events, the buffer header spinlock itself doesn't.. So I'm inclined to not change anything about this for now. Greetings, Andres Freund