On Thu, Feb 22, 2024 at 11:53:50AM -0800, Jeff Davis wrote: > On Thu, 2024-02-22 at 12:58 +0530, Bharath Rupireddy wrote: >> There's some immediate use for reads/writes with barrier semantics - > > Is this mainly a convenience for safety/readability? Or is it faster in > some cases than doing an atomic access with separate memory barriers?
The former. Besides the 0002 patch tracked here, there's at least one other patch [0] that could probably use these new functions. The idea is to provide an easy way to remove spinlocks, etc. and use atomics for less performance-sensitive stuff. The implementations are intended to be relatively inexpensive and might continue to improve in the future, but the functions are primarily meant to help reason about correctness. I don't mind prioritizing these patches, especially since there now seems to be multiple patches waiting on it. IIRC I was worried about not having enough support for this change, but I might now have it. [0] https://commitfest.postgresql.org/47/4330/ -- Nathan Bossart Amazon Web Services: https://aws.amazon.com