On 19.12.2020 10:53, Zhihong Yu wrote:
> Hi,
> w.r.t. the code in BufferAlloc(), the pointers are compared.
>
> Should we instead compare the tranche Id of the two LWLock ?
>
> Cheers
As far as LWlocks are stored in the array, comparing indexes in this
array (tranche Id) is equivalent to comparing element's pointers.
So I do not see any problem here.
Just as experiment I tried a version of BufferAlloc without double
locking (patch is attached).
I am not absolutely sure that my patch is correct: my main intention was
to estimate influence of this buffer reassignment on performance.
I just run standard pgbench for database with scale 100 and default
shared buffers size (256Mb). So there are should be a lot of page
replacements.
I do not see any noticeable difference:
vanilla: 13087.596845
patch: 13184.442130