-
Notifications
You must be signed in to change notification settings - Fork 38.7k
net: Replace cs_feeFilter with simple std::atomic #18819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Not sure if we care about this case, but this adds a strict assumption that CAmount is a typedef of an primitive integer type. |
|
Yeah, I thought about making a simple setter/getter to not leak the std::atomic implementation detail from |
This assumption is already used: Lines 442 to 443 in e5b9308
EDIT: I've reconsidered this pull. |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Light tested ACK fa321c4afe.
@hebasto I can't parse this sentence. Mind to explain? We already assume that the type is |
|
Unless a performance improvement can be demonstrated I'm not sure this change is really worth it. |
|
It is mostly about the removed code (11 lines), and cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention. |
|
Performance wise this should have no effect. Reading from the mempool is orders of magnitude slower than taking a lock on a recursive mutex (even with lock contention debugging enabled). |
@MarcoFalke Apologies for my confusing comment. |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
fa321c4 to
fa3c2c2
Compare
|
Rebased |
hebasto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fa3c2c2, I have reviewed the code and it looks OK, I agree it can be merged.
|
utACK fa3c2c2 All this stuff should move to |
fa3c2c2 to
fad1f0f
Compare
|
Rebased due to trivial conflict in adjacent line |
|
utACK fad1f0f |
|
cr ACK fad1f0f: patch looks correct |
fad1f0f net: Remove unused cs_feeFilter (MarcoFalke) Pull request description: A `RecursiveMutex` is overkill for setting or reading a plain integer. Even a `Mutex` is overkill, when a plain `std::atomic` can be used. This removes 11 lines of code. Also, it is cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention. ACKs for top commit: jnewbery: utACK fad1f0f practicalswift: cr ACK fad1f0f: patch looks correct Tree-SHA512: 647f9b954fbf52e138d3e710937eb9131b390fef0deae03fd6a162d5a18b9f194010800bbddc8f89208d91be2802dff11c3884d04b3dd233865abd12aa3cde06
A
RecursiveMutexis overkill for setting or reading a plain integer. Even aMutexis overkill, when a plainstd::atomiccan be used.This removes 11 lines of code. Also, it is cutting down on the number of locks put on the stack at the same time, which complicates review looking out for potential lock contention.