-
-
Notifications
You must be signed in to change notification settings - Fork 446
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
improve one_size_heap_list: use rwlock to speedup the allocation/free #6370
Conversation
Can one of the admins verify this patch? |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
@JiakunYan I think we can improve the implementation of our hpx/libs/core/synchronization/include/hpx/synchronization/shared_mutex.hpp Lines 29 to 35 in 103a7b8
|
@hkaiser I did some brief benchmarking using Octotiger on Rostam. The performance of the new shared lock is pretty good! (around 5% improvement for a specific octotiger configuration) |
dbe436f
to
c51afc0
Compare
c51afc0
to
0f41e91
Compare
d813e5f
to
49e0553
Compare
@JiakunYan this looks good now and the test errors are unrelated. Can this be merged now? |
Sure! |
Could you fix the conflicts, please? |
I tried rebasing this PR to the current master branch. However, git is behaving somehow weirdly. It kept missing to apply some changes in the Trying to streamline shared_mutex. Could you try rebasing it on your end and see what will happen? |
If I rebase my branch, then you will not be able to merge it to your branch because of conflicts. I'll resolve the conflicts manually and merge your work manually as well. Thanks! |
The original implementation uses an HPX mutex to ensure thread safety. This PR replaces it with a pthread rwlock, which greatly improves its performance. Multiple allocation/free calls can proceed simultaneously under the read lock, and the pthread read lock only costs an atomic fetch-and-add in most cases.
Need to discuss: directly using pthread rwlock in HPX codebase may not be a good idea, but implementing the whole pthread rwlock algorithm in HPX can also be cumbersome.