Re: Fix bank selection logic in SLRU
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: "Andrey M. Borodin" <x4mmm@yandex-team.ru>
Cc: Yura Sokolov <y.sokolov@postgrespro.ru>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2024-12-10T14:07:34Z
Lists: pgsql-hackers
On Tue, 10 Dec 2024 at 6:32 PM, Andrey M. Borodin <x4mmm@yandex-team.ru> wrote: > > > > 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 nearest power of 2 - we will help > incorrectly configured systems to use proper amount of memory and keep > performance of properly configured systems. +1 > > IMO doing modulo is not necessary. And hash function is pure waste of CPU > cycles. I agree — Dilip >
Commits
-
Fix SLRU bank selection code
- ffd9b8134658 17.3 landed
- 69ab44651422 18.0 landed