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 1tODyi-004wyj-8z for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Dec 2024 10:42:00 +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 1tODxj-00B3u3-8f for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Dec 2024 10:40:58 +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.94.2) (envelope-from ) id 1tODuj-00AyXx-TJ for pgsql-hackers@lists.postgresql.org; Thu, 19 Dec 2024 10:37:53 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tODug-000ZI3-7l for pgsql-hackers@lists.postgresql.org; Thu, 19 Dec 2024 10:37:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1734604669; bh=AQmC31onYs60U89HMhwJKWRmFS6HlzFyJeO4DMjbJQw=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=23t6H74dVCmNzaXsSIZnscwnR57a5CAKZ+M81FeU3EesuSEMtDF0781VbSQksyMgI lyqWAS+Gwmx5HR2cc/tJnb+Gpbhx3U0y9vsbMN9/WkFywgLYn/Oe6svu8+uw/dJr1+ OinlQ7V6RMGX7yy+bmnAKP6UCCaz9L8/jMeB4LbG8oy1TO6oOAbLXoe2zfnyPNywNL g6E7zNiBnFhMrI0OPzd3vMovywa+nFGQfYMZ5cOHQI/Y4kNshIEm5Wn1X0KDCLgXzt lEzGmxIJqf1mWsfLOCOem3PrctJWdGGq+SNeNH6jWTJCd4Sw/TDTMoBg4gIfBU1mCc WTqjoa4W2r5Zw== Received: from [172.30.49.34] (unknown [172.30.49.34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) (Authenticated sender: y.sokolov@postgrespro.ru) by mail.postgrespro.ru (Postfix/465) with ESMTPSA id D133760306; Thu, 19 Dec 2024 13:37:48 +0300 (MSK) Message-ID: <438161d6-6f76-45cf-b8cd-0e756c9973e1@postgrespro.ru> Date: Thu, 19 Dec 2024 13:37:48 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Fix bank selection logic in SLRU To: Andrey Borodin Cc: Dilip Kumar , "pgsql-hackers@lists.postgresql.org" , Alvaro Herrera References: <9444dc46-ca47-43ed-9058-89c456316306@postgrespro.ru> <4009750D-3EAE-4375-A7A8-3AD9922CDE1F@yandex-team.ru> Content-Language: en-US From: Yura Sokolov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2024/12/19 06:47:00 #26889573 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 19.12.2024 13:10, Andrey Borodin пишет: > > >> On 19 Dec 2024, at 15:01, Yura Sokolov wrote: >> >> - `&` takes 0.69ns >> - `mult-rec` takes 2.94ns >> - `%` takes 3.24ns. > > Thanks, Yura, for benchmarks and off-list conversation. > I’ve reproduced similar numbers on my Apple M2. > I agree that additional 3-4ns are negligible in case of SLRU access. > > > > + bits16 nbanks; > > Perhaps, it’s not bits anymore. Also, is 64K banks ought enough for everybody? > > > Best regards, Andrey Borodin. There are artificial limit currently: #define SLRU_MAX_ALLOWED_BUFFERS ((1024 * 1024 * 1024) / BLCKSZ) #define SLRU_BANK_BITSHIFT 4 #define SLRU_BANK_SIZE (1 << SLRU_BANK_BITSHIFT) So, there's no more than 8192 banks at the moment. But I believe, some customers will want to have more than 1GB of SLRU in the future. (They do already actually) ---- Yura