Re: locked reads for atomics
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org
Date: 2024-02-23T16:17:58Z
Lists: pgsql-hackers
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
Commits
-
Convert archiver's force_dir_scan variable to an atomic variable.
- 3179701505b9 17.0 landed
-
Introduce atomic read/write functions with full barrier semantics.
- bd5132db558b 17.0 landed