forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Blockstore max_root from RwLock<Slot> to AtomicU64 (solana-lab…
…s#33998) The Blockstore currently maintains a RwLock<Slot> of the maximum root it has seen inserted. The value is initialized during Blockstore::open() and updated during calls to Blockstore::set_roots(). The max root is queried fairly often for several use cases, and caching the value is cheaper than constructing an iterator to look it up every time. However, the access patterns of these RwLock match that of an atomic. That is, there is no critical section of code that is run while the lock is head. Rather, read/write locks are acquired in order to read/ update, respectively. So, change the RwLock<u64> to an AtomicU64.
- Loading branch information
Showing
5 changed files
with
55 additions
and
61 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
Oops, something went wrong.