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.94.2) (envelope-from ) id 1rXJ4r-009u9o-AL for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Feb 2024 10:53:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rXJ4q-0038bT-FC for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Feb 2024 10:53:20 +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.94.2) (envelope-from ) id 1rXJ4p-0038bL-T5 for pgsql-hackers@lists.postgresql.org; Tue, 06 Feb 2024 10:53:20 +0000 Received: from fhigh5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rXJ4m-005LYw-Px for pgsql-hackers@lists.postgresql.org; Tue, 06 Feb 2024 10:53:18 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 376671140092; Tue, 6 Feb 2024 05:53:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 06 Feb 2024 05:53:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1707216795; x= 1707303195; bh=tJsXzi725kvPL4BY00HNXw5WgzRl32ewo0yTT20mpyw=; b=v DwndQxD/qN4qVoK3qS6Blr0EYyxhpv6WjtJap9ERDsrX/ktJgIfcGULiQtHdD6nS KO/0kH1dxZ++MgaZnvL8VpWNE9Aj6vkE0J5gY5h4M0rdGyO9D8JSTJxFWZgQG2gc P5keB3V46to526TSBz0RX6u+bBKwBkazecC5tSEfpEko4sH2re1TZeI392DQCLDR /tJbxxP4hPqXtuF+Fauw1b1TwisMPX+fcFSYzRrthFjwTAB0h302AWDjQpkcFbOh 7Im6w5roPr048KMxcFFUjzEDhpjt+ACUClm30t4X71R+nO/FF7n6s0jEDXiOp3Zm nnn175b7GBNreS/PaulQQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedvfedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Feb 2024 05:53:14 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1707216792; bh=MXAzFn+J2cwiXB21an+ym9wdEFDbQLfLgomCi0E00ko=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=HR+i6x3tAPMD8jYvctDAlpnT/blrh/yuoE47v8wLry0rQvgjeBs+n7dVBaZCfALT+ Kpyp2P9+dFgwKXUNxfdUsoEjDZIxv+5kgGU+oSJjvwqLnnK9dbhkyi0LJGHzbygrIh du2+0g+/lTsQMpX/PLMPjsQ4z7N8/xw7uzN4K8tCHUDHdAGeyqk+rUI0FNIrUfIvrD fFHly99UtajBmDxs/09ZiT14ooAScyg/Cgsm8K7PnQKr1Fvc+dmMekM1zlszbMEoKI DXQupkRZOf8f6irIApM/pKIzvBf2Ep/8tJwk4l+HkSODDo4gbIRx+Bk5K3oxv70dH/ +3sD31yYRbhjA== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id E22D1BE3; Tue, 6 Feb 2024 11:53:12 +0100 (CET) Date: Tue, 6 Feb 2024 11:53:12 +0100 From: Alvaro Herrera To: "Andrey M. Borodin" , Dilip Kumar Cc: tender wang , PostgreSQL Hackers Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock Message-ID: <202402061053.smxzqyip6m5l@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Feb-04, Andrey M. Borodin wrote: > This patch uses wording "banks" in comments before banks start to > exist. But as far as I understand, it is expected to be committed > before "banks" patch. True -- changed that to use ControlLock. > Besides this patch looks good to me. Many thanks for reviewing. On 2024-Feb-05, Dilip Kumar wrote: > > (We also have SimpleLruTruncate, but I think it's not as critical to > > have a barrier there anyhow: accessing a slightly outdated page number > > could only be a problem if a bug elsewhere causes us to try to truncate > > in the current page. I think we only have this code there because we > > did have such bugs in the past, but IIUC this shouldn't happen anymore.) > > +1, I agree with this theory in general. But the below comment in > SimpleLruTrucate in your v3 patch doesn't seem correct, because here > we are checking if the latest_page_number is smaller than the cutoff > if so we log it as wraparound and skip the whole thing and that is > fine even if we are reading with atomic variable and slightly outdated > value should not be a problem but the comment claim that this safe > because we have the same bank lock as SimpleLruZeroPage(), but that's > not true here we will be acquiring different bank locks one by one > based on which slotno we are checking. Am I missing something? I think you're correct. I reworded this comment, so now it says this: /* * An important safety check: the current endpoint page must not be * eligible for removal. This check is just a backstop against wraparound * bugs elsewhere in SLRU handling, so we don't care if we read a slightly * outdated value; therefore we don't add a memory barrier. */ Pushed with those changes. Thank you! Now I'll go rebase the rest of the patch on top. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Having your biases confirmed independently is how scientific progress is made, and hence made our great society what it is today" (Mary Gardiner)