perf: convert m_nodes_mutex to a non-recursive mutex#6473
perf: convert m_nodes_mutex to a non-recursive mutex#6473PastaPastaPasta wants to merge 1 commit intodashpay:developfrom
Conversation
|
This pull request has conflicts, please rebase. |
32a7a8c to
fb561ef
Compare
|
CI is pretty unhappy... |
|
I had changes that fixed this, but they're on my dead system... will have to wait a week or so before I can recover them. |
|
This pull request has conflicts, please rebase. |
ℹ️ Backport Verification - Not ApplicableThis PR is not a Bitcoin Core backport and therefore does not require backport verification. Analysis Results:
Summary: The backport verification system is designed exclusively for Bitcoin Core backports to Dash Core. Original Dash changes should be reviewed by the Dash Core development team using the standard review process. Recommendation: Continue with standard Dash Core review process. |
|
superseded by: #6912 |
Issue being fixed or feature implemented
If we are able to get this merged, I'll probably try to upstream this.
m_nodes_mutex is heavily contended; likely more-so in dash than bitcoin, due to master nodes aggressively sending out signature shares and related messages, and additional logic that uses stuff like ForEachNode.
Long term, I may want to convert the non-recursive mutex into a shared mutex, similar to the logic in 6468 as m_nodes is only actually mutated (hence needing an exclusive lock) when nodes are added or removed. CNode is internally thread safe.
As you can see below, m_nodes_mutex represents ~90% of all contention on ~latest nightly on testnet during tx/islock spamming. Making this into a non-recursive mutex will likely significantly reduce the time a contention takes, although, the contention itself likely won't go away.
What was done?
Convert m_nodes_mutex from RecursiveMutex -> Mutex and fix all compilation errors.
How Has This Been Tested?
This should be tested with a tsan reindex and otherwise tsan test suite, which has not been done yet.
Breaking Changes
N/a
Checklist:
Go over all the following points, and put an
xin all the boxes that apply.