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 1r3yF6-006qLd-6Z for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Nov 2023 12:46:40 +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 1r3yF4-00Dvoy-Dz for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Nov 2023 12:46: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.94.2) (envelope-from ) id 1r3yF2-00Dvoo-Qh for pgsql-hackers@lists.postgresql.org; Fri, 17 Nov 2023 12:46:38 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r3yEz-00614t-Tl for pgsql-hackers@lists.postgresql.org; Fri, 17 Nov 2023 12:46:35 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.nyi.internal (Postfix) with ESMTP id CE48E5C012B; Fri, 17 Nov 2023 07:46:31 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Fri, 17 Nov 2023 07:46:31 -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:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1700225191; x= 1700311591; bh=iYdh22tvLx1PfOaUmmaDIu1yg4+VkE07HlrQ9B14ecs=; b=D j6g5up2E3xQOP6K3RL4SeGyBudUnNRhHrPz+UGvuNX9fraSAG53IMBDtPPT4ZN1V GIUkFgGHibnvprlb3jHA0M3ROVXQLjKSxXKYlcGNESxgaCPoaQq2qu1yvjSc1fXp lCBbLYfbIPjvHuFin3GCrTy+pUAW6tTHrbPL3DTDjRmcIHJWzLvBTnNjKkGcXivI wMM7Fwdp9X1LMDwUaPs7T9vCpyDIIf2z3I55ZmtF8i0qYOIOjCL63Uaatg1+6G/e 2EWBgri4cK9k6Dze9qAoJUKFy/O2NhBSrlMRnfRLVWVYRoy4WhCBmw+To+112MJ8 Ke0v0lfSwAITh4fz97bZw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudegtddggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Nov 2023 07:46:31 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1700225189; bh=b43M2u5Rd3LYCYP9qhGgA+rZd+4kreUy4pXOES3JbC8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Io7EqW+IBUvh0IKuOtfNwsp5Y0+noTG8phgHFtit2RA8H0RHK3ZPzNkREU4/QZNRk +YCZxpfnw9fGclNkgB8iGdJLZmvLdUTm1FC/2hNmdF6pD9ZYV7XbpNQvHx/bHo+16U NVmaLWzERzPddYTRWHZT0b/pgxldjVQFM/X+b+Iv8oKB/Z5LJD9BdkAKYQ8mcoh4R2 efV9WsvsrcKMVZ3SYe0iNf/qncnUx2ieL8WlTpJCDaRYO1Jxryfgzipq1R29Bu6d9Y A2n0BAmR9l5ZRjbQt7q+niHS043pSQwWFLj6WkfKNl6sUzeDD77PaI7lqRQqwYQ/EF Y7AWmT5ECK66w== Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 26351127; Fri, 17 Nov 2023 13:46:29 +0100 (CET) Date: Fri, 17 Nov 2023 13:46:29 +0100 From: Alvaro Herrera To: Dilip Kumar Cc: "Andrey M. Borodin" , PostgreSQL Hackers Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock Message-ID: <202311171246.zyuurxvs3oqu@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 In SlruSharedData, a new comment is added that starts: "Instead of global counter we maintain a bank-wise lru counter because ..." You don't need to explain what we don't do. Just explain what we do do. So remove the words "Instead of a global counter" from there, because they offer no wisdom. Same with the phrase "so there is no point to ...". I think "The oldest page is therefore" should say "The oldest page *in the bank* is therefore", for extra clarity. I wonder what's the deal with false sharing in the new bank_cur_lru_count array. Maybe instead of using LWLockPadded for bank_locks, we should have a new struct, with both the LWLock and the LRU counter; then pad *that* to the cacheline size. This way, both the lwlock and the counter come to the CPU running this code together. Looking at SlruRecentlyUsed, which was a macro and is now a function. The comment about "multiple evaluation of arguments" no longer applies, so it needs to be removed; and it shouldn't talk about itself being a macro. Using "Size" as type for bank_mask looks odd. For a bitmask, maybe it's be more appropriate to use bits64 if we do need a 64-bit mask (we don't have bits64, but it's easy to add a typedef). I bet we don't really need a 64 bit mask, and a 32-bit or even a 16-bit is sufficient, given the other limitations on number of buffers. I think SimpleLruReadPage should have this assert at start: + Assert(LWLockHeldByMe(SimpleLruGetSLRUBankLock(ctl, pageno))); Do we really need one separate lwlock tranche for each SLRU? -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Cuando mañana llegue pelearemos segun lo que mañana exija" (Mowgli)