On Thu, Sep 12, 2024 at 9:57 AM Heikki Linnakangas <hlinn...@iki.fi> wrote: > If you make no changes to s_lock.h at all, will it work? Why not?
It's good to keep the work independent and I don't want to hold up anything happening in this thread, but just for information: I have been poking around at the idea of entirely removing the old spinlock code and pointing spin.h's function-like-macros to the atomics code. We couldn't do that before, because atomics were sometimes implemented with spinlocks, but now that pg_atomic_flag is never implemented with spinlocks we can flip that around, and then have only one place where we know how to do this stuff. What is needed for that to progress is, I guess, to determine though assembler analysis or experimentation across a bunch of targets that it works out at least as good... https://www.postgresql.org/message-id/flat/CA%2BhUKGJ%2BoA%2B62iUZ-EQb5R2cAOW3Y942ZoOtzOD%3D1sQ05iNg6Q%40mail.gmail.com#23598cafac3dd08ca94fa9e2228a4764