forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit69ab446
committed
Fix SLRU bank selection code
The originally submitted code (using bit masking) was correct when thenumber of slots was restricted to be a power of two -- but thatlimitation was removed during development that led to commit53c2a97, which made the bank selection code incorrect. This led toalways using a smaller number of banks than available. Change said codeto use integer modulo instead, which works correctly with an arbitrarynumber of banks.It's likely that we could improve on this to avoid runtime use ofinteger division. But with this change we're, at least, not wastingmemory on unused banks, and more banks mean less contention, which islikely to have a much higher performance impact than a singleinstruction's latency.Author: Yura Sokolov <y.sokolov@postgrespro.ru>Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>Discussion:https://postgr.es/m/9444dc46-ca47-43ed-9058-89c456316306@postgrespro.ru1 parent970b97e commit69ab446
2 files changed
+6
-9
lines changedLines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
343 | 343 |
| |
344 | 344 |
| |
345 | 345 |
| |
346 |
| - | |
| 346 | + | |
347 | 347 |
| |
348 | 348 |
| |
349 | 349 |
| |
| |||
606 | 606 |
| |
607 | 607 |
| |
608 | 608 |
| |
609 |
| - | |
| 609 | + | |
610 | 610 |
| |
611 | 611 |
| |
612 | 612 |
| |
| |||
1180 | 1180 |
| |
1181 | 1181 |
| |
1182 | 1182 |
| |
1183 |
| - | |
| 1183 | + | |
1184 | 1184 |
| |
1185 | 1185 |
| |
1186 | 1186 |
| |
|
Lines changed: 3 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
128 | 128 |
| |
129 | 129 |
| |
130 | 130 |
| |
131 |
| - | |
132 |
| - | |
133 |
| - | |
134 |
| - | |
| 131 | + | |
| 132 | + | |
135 | 133 |
| |
136 | 134 |
| |
137 | 135 |
| |
| |||
163 | 161 |
| |
164 | 162 |
| |
165 | 163 |
| |
166 |
| - | |
167 | 164 |
| |
168 | 165 |
| |
169 | 166 |
| |
| |||
179 | 176 |
| |
180 | 177 |
| |
181 | 178 |
| |
182 |
| - | |
| 179 | + | |
183 | 180 |
| |
184 | 181 |
| |
185 | 182 |
| |
|
0 commit comments
Comments
(0)