Subject: pgsql: Use atomic access for SlruShared->latest_page_number

From: Alvaro Herrera <[email-masked]>
Date: Tue, 06 Feb 2024 10:42:09 +0000

Use atomic access for SlruShared->latest_page_number

The new concurrency model proposed for slru.c to improve performance
does not include any single lock that would coordinate processes
doing concurrent reads/writes on SlruShared->latest_page_number.
We can instead use atomic reads and writes for that variable.

Author: Dilip Kumar <[email-masked]>
Reviewed-by: Andrey M. Borodin <[email-masked]>
Discussion: https://postgr.es/m/CAFiTN-vzDvNz=[email-masked]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d172b717c6f436738cc8383a4e9f611ae227fd93

Modified Files
--------------
src/backend/access/transam/clog.c      |  6 +-----
src/backend/access/transam/commit_ts.c |  7 +++---
src/backend/access/transam/multixact.c | 28 ++++++++++++++----------
src/backend/access/transam/slru.c      | 39 ++++++++++++++++++++++++----------
src/include/access/slru.h              |  5 ++++-
5 files changed, 53 insertions(+), 32 deletions(-)

---

From: Alvaro Herrera <[email-masked]>
Date: Tue, 6 Feb 2024 12:05:01 +0100

> Use atomic access for SlruShared->latest_page_number

rorqual failed (--disable-atomics --disable-spinlocks).  Looking into it ...

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"Nunca se desea ardientemente lo que solo se desea por razón" (F. Alexandre)