[SERVER-65725] Mutex stats counters can use relaxed mode atomics Created: 18/Apr/22 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Matthew Russotto | Assignee: | Backlog - Service Architecture |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Service Arch
|
||||||||
| Participants: | |||||||||
| Description |
|
The various updates of "counts()" in platform/mutex.cpp use fetchAndAdd, which I believe uses the default sequential memory ordering. These can use fetchAndAddRelaxed. Additionally the state.isFinalized check can use acquire/release semantics rather than sequential, though I think our AtomicWord class doesn't support that |
| Comments |
| Comment by Billy Donahue [ 19/Apr/22 ] |
|
I think those AtomicWord data members should also get their own cache lines to avoid false sharing. I also don't think the implementation of a Mutex class should be limited to only using the AtomicWord wrapper. It's low-level enough that the full capabilities of stdx::mutex should be available to its implementation if needed. |