-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strengthen memory barriers used by benign reads and writes
`drainStatus` The status is used to trigger the maintenance and guard against some unnecessary runs. As the maintenance work is fast, atomic, and expected to run frequently there is no harm even if a race causes an extra execution. This might happen due to a buffered write to transition into the processing state being stomped on by a cache write CAS'ing to flag that a drain is required ASAP. This case now uses a stronger release and opaque is used where no conflicting writes are possible. The loop in `scheduleAfterWrite()` only assumes a read barrier if retrying due to a failed CAS. This is guaranteed on weakly ordered memory models like Arm's. We specifically avoided assumptions like [1] that tried to piggyback other writes onto a CAS. `timestamps` The expiration timestamps are upgraded from plain loads and stores to opaque ones. This is primarily for code clarity when matching operations against [2]. A benefit is that it does ensure 64-bit loads on 32-bit systems to avoid word tearing (as allowed by the Java spec, but is no longer applicable). [1] https://youtu.be/EFkpmFt61Jo?t=1789 [2] http://gee.cs.oswego.edu/dl/html/j9mm.html
- Loading branch information
Showing
6 changed files
with
50 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters