Re: Fix bank selection logic in SLRU - Mailing list pgsql-hackers

From Andrey M. Borodin
Subject Re: Fix bank selection logic in SLRU
Date
Msg-id 4009750D-3EAE-4375-A7A8-3AD9922CDE1F@yandex-team.ru
Whole thread Raw
Responses Re: Fix bank selection logic in SLRU
Re: Fix bank selection logic in SLRU
List pgsql-hackers

> On 10 Dec 2024, at 15:39, Yura Sokolov <y.sokolov@postgrespro.ru> wrote:
>
> It is not critical bug, since it doesn't hurt correctness just performance. In worst case only one bank will be used.

Ugh... yeah. IMO the problem is that we do not have protection that rejects values that are not power of 2.
If other values given system operates as if there are 2^(popcount(n)-1) banks. So if we just round down value to
nearestpower of 2 - we will help incorrectly configured systems to use proper amount of memory and keep performance of
properlyconfigured systems. 

IMO doing modulo is not necessary. And hash function is pure waste of CPU cycles.


Best regards, Andrey Borodin.


pgsql-hackers by date:

Previous
From: "Andrey M. Borodin"
Date:
Subject: Re: bt_index_parent_check and concurrently build indexes
Next
From: Dilip Kumar
Date:
Subject: Re: Fix bank selection logic in SLRU