Add local thread pool to CCheckQueue#18710
Conversation
|
Concept ACK on getting rid of boost in consensus code. This pull looks similar to #14464? |
cc @JeremyRubin |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
9764d81 to
f4cd37e
Compare
|
Updated 9764d81 -> f4cd37e (pr18710.01 -> pr18710.02, diff):
|
|
Nice! From a simple code review PoV it looks good. I remember there being a bunch of subtle nasties in the specifics of using std::threads v.s. boost threads around interrupt system and the details of how condition variables work. I can't remember what they all were though now. I think #14464 closed because of that... But generally huge concept ack on anything that makes #9938 more likely to move forward! Note though that the cuckoocache sort of stole it's thunder -- a lot of the contention in the CheckQueue was around the sigcache locking and the cuckoocache made that stuff way faster so it's not obvious #9938 will show as impressive gains, and the trade offs for consensus code may be less worth it. Can discuss more via IRC; I'd love to get some of the improvements through in any case. |
The differences from #14464 are: |
f4cd37e to
b02bc25
Compare
|
Updated f4cd37e -> b02bc25 (pr18710.02 -> pr18710.03, diff):
|
|
Benchmark results on my machine:
|
b02bc25 to
f16f7f7
Compare
|
Rebased b02bc25 -> f16f7f7 (pr18710.03 -> pr18710.04) due to the conflict with #18575. |
maflcko
left a comment
There was a problem hiding this comment.
Approach ACK f16f7f7 🌘
Show signature and timestamp
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Approach ACK f16f7f79dcd5d6c1b55966317b8762abeb5561c3 🌘
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhhpwv+NPSS8v5sdXJqBUVegg4/8o1tsvoNpU9cE80q4qYqkmrP2V55QWbkG2VI
NE6+E0XSgTx8UuESI+9YEJ9+8gH4jCgNIqDMS4dqG+uPeeTXJUKn39Jn59YuaJGQ
yWCCO4BZXqW/DWCLVpcDINXGtlZgFR3sv53RiFPWw+NNU5aJYTFssv9KJ8nBQVko
SXNKSNzFxqx2oafuIaF+Ikrp+HbPzwE7Xrk2byS9Od1sA8d/LGkbhxBB4j32L4NT
8NNUBKdata4zjzkQCXHIrBYNxJxy8/qK45lMO4WjiApxyA5kbbOZ20v9eyh8oF5I
4hsvQN1Bpvdm8hK3oqxcLzZ2/QO6SjkNnVslNlFeYubasFMoTGS7n0SMqgmqgIbW
qi9sMpsuMEBov6wq5kCIpWTBwHIuDMeRbjo/dOkJcTNqJHu8+s83aqD8P3MbTa0y
ykeCbWwB8k0v5SPGhKMRx5sUMOGHQBWboDRzDJmNF909W+Yd3DL+C0qONk6vvMSy
03UYQCgR
=16Sm
-----END PGP SIGNATURE-----
Timestamp of file with hash fd6cc8b78bfb432d1fffbc1706dd13c7f3563a0d2caef6be9b45688ccd1b15ad -
f16f7f7 to
7a7e346
Compare
|
Updated f16f7f7 -> 7a7e346 (pr18710.04 -> pr18710.05, diff):
|
|
In the last commit: Could replace the last occurrence of |
7a7e346 to
6173917
Compare
|
Updated 7a7e346 -> 6173917 (pr18710.05 -> pr18710.06, diff):
|
|
@MarcoFalke |
|
Concept ACK, will plan to review. |
LarryRuane
left a comment
There was a problem hiding this comment.
nit: remove the #include <boost/thread/thread.hpp> from checkqueue_tests.cpp.
Looks good. I ran the affected tests (and single-stepped through most of the new test code), and verified using debugger that a mainnet node correctly reaches the real script checking code.
ACK bb6fcc7
|
It builds for me without that include. Oh, I see, it's included indirectly via |
|
Thanks for getting rid of the one-to-last use of Code review ACK bb6fcc7 |
bb6fcc7 refactor: Drop boost::thread stuff in CCheckQueue (Hennadii Stepanov) 6784ac4 bench: Use CCheckQueue local thread pool (Hennadii Stepanov) dba3069 test: Use CCheckQueue local thread pool (Hennadii Stepanov) 0151177 Add local thread pool to CCheckQueue (Hennadii Stepanov) 0ef9386 refactor: Use member initializers in CCheckQueue (Hennadii Stepanov) Pull request description: This PR: - gets rid of `boost::thread_group` in the `CCheckQueue` class - allows thread safety annotation usage in the `CCheckQueue` class - is alternative to bitcoin#14464 (bitcoin#18710 (comment), bitcoin#18710 (comment)) Also, with this PR (I hope) it could be easier to resurrect a bunch of brilliant ideas from bitcoin#9938. Related: bitcoin#17307 ACKs for top commit: laanwj: Code review ACK bb6fcc7 LarryRuane: ACK bb6fcc7 jonatack: Code review ACK bb6fcc7 and verified rebase to master builds cleanly with unit/functional tests green Tree-SHA512: fddeb720d5a391b48bb4c6fa58ed34ccc3f57862fdb8e641745c021841c8340e35c5126338271446cbd98f40bd5484f27926aa6c3e76fa478ba1efafe72e73c1
After the merge of bitcoin#18710, the linter is warning: ```bash A new Boost dependency in the form of "boost/thread/mutex.hpp" appears to have been introduced: src/sync.cpp:#include <boost/thread/mutex.hpp> src/test/sync_tests.cpp:#include <boost/thread/mutex.hpp> ^---- failure generated from test/lint/lint-includes.sh ``` the interim bitcoin#19337 was merged, which introduced more `boost::mutex` usage. Given we no longer use `boost::mutex`, just remove the double lock test and remaining includes.
f827e15 refactor: remove straggling boost::mutex usage (fanquake) Pull request description: After the merge of #18710, the linter is warning: ```bash A new Boost dependency in the form of "boost/thread/mutex.hpp" appears to have been introduced: src/sync.cpp:#include <boost/thread/mutex.hpp> src/test/sync_tests.cpp:#include <boost/thread/mutex.hpp> ^---- failure generated from test/lint/lint-includes.sh ``` #18710 removed `boost/thread/mutex.hpp` from lint-includes, however in the interim #19337 was merged, which introduced more `boost::mutex` usage. Given we no longer use `boost::mutex`, just remove the double lock test and remaining includes. ACKs for top commit: laanwj: Code review ACK f827e15 hebasto: ACK f827e15 Tree-SHA512: f738b12189fe5b39db3e8f8231e9002714413a962eaf98adc84a6614fa474df5616358cfb1c89b92a2b0564efa9b704a774c49d4a25dca18a0ccc3cd9eabfc0a
dc8be12 refactor: remove boost::thread_group usage (fanquake) Pull request description: Post #18710, there isn't much left using `boost::thread_group`, so should just be able to replace it with the standard library. This also removes the last use of `boost::thread_interrupted`. After this change, last piece of Boost Thread we'd be using is `boost::shared_mutex`. See the commentary [here](#16684 (comment)) as to why it may be non-trivial to swap that for `std::shared_mutex` in the near future. Closes #17307 ACKs for top commit: laanwj: Code review re-ACK dc8be12 MarcoFalke: review ACK dc8be12 🔁 jonatack: Non-expert code review ACK dc8be12, also checked range-diff since last review and that local debug build is clean with gcc 10.2.1-6 on Debian Tree-SHA512: 5510e2d760cce824234207dc86b1551ca8f21cbf3a2ce753c0254a0d03ffd83c94e449aec202fb7bd76e6fc64df783a6b70a736b0add9ece3734bb9c8ce8fc2f
This PR:
boost::thread_groupin theCCheckQueueclassCCheckQueueclassAlso, with this PR (I hope) it could be easier to resurrect a bunch of brilliant ideas from #9938.
Related: #17307