-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
reduce the lock contention in task spawn. #6001
Merged
Darksonn
merged 104 commits into
tokio-rs:master
from
wathenjiang:reduce-lock-contention
Dec 7, 2023
Merged
Changes from 60 commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
895958f
reduce the lock contention in task spawn.
wathenjiang ae64dfe
Merge branch 'master' into reduce-lock-contention
wathenjiang 5ffbf01
rm extra criterion in dependencies
wathenjiang 8e2c0b2
restart a ci
wathenjiang 33ab489
fix for each
wathenjiang ab2452c
fix for_each
wathenjiang a500a79
reduce the size of header
wathenjiang 632a8d3
code refactor in list.rs
wathenjiang 6453017
change ordering of atomic
wathenjiang 9bfb4f1
fix iterate in close_and_shutdown
wathenjiang 41ee62a
Merge branch 'master' into reduce-lock-contention
wathenjiang b4ac885
fix iterate in close_and_shutdown
wathenjiang 4b386c5
fix atomic method
wathenjiang 9ded74b
rm type CountedOwnedTasksInner
wathenjiang 191edf6
refactor for_each
wathenjiang 06a675c
Merge branch 'master' into reduce-lock-contention
wathenjiang 2be70c4
use atomic type in loom instead
wathenjiang 17b0be9
fix: put read closed flag after got the lock for avoid concurrency pr…
wathenjiang 3bb484e
introduce random make shutdown faster
wathenjiang e325825
use grain instead
wathenjiang a11f80c
fix: dead lock
wathenjiang 259582e
Merge branch 'master' into reduce-lock-contention
wathenjiang cab1f58
fix: use list_inner to offer lock of list
wathenjiang 389e6b9
fix: use segment_size instead of grain
wathenjiang 833377c
clippy
wathenjiang 5422895
feat: let spawn_concurrency_level configurable
wathenjiang b90101a
feat: update benchmark
wathenjiang 68af71a
feat: add benchmarks for spawn_concurrency_level
wathenjiang 8e4716a
change spawn_concurrency_level to be 4 times the number of worker thr…
wathenjiang 4a3ff7a
Merge branch 'master' into reduce-lock-contention
wathenjiang 7bbc2e4
change benchmark tests name from shutdown_parallel_multi_thread to sh…
wathenjiang c15c0bd
fix the comments on spawn_concurrency_level
wathenjiang 6706a35
add comments for parameter in OwnedTasks.close_and_shutdown_all
wathenjiang d2c7668
fix comments
wathenjiang 5105610
style nit: simplify code, apply suggestions from hawkw
wathenjiang a30df11
make spawn_concurrency_level is constant 4 in loom test
wathenjiang df4ab61
use Header::get_id to get task_id
wathenjiang 63a7679
change owned_id to u64 back
wathenjiang b2010d7
refactor: use local_staic in loom
wathenjiang 052e141
fix: OwnedTasks get all locks first
wathenjiang 65670eb
fix: rm segment_size field of OwnedTasks, use method to return it ins…
wathenjiang 08d7d0c
feat: make spawn_concurrency_level to be a unstable api
wathenjiang 26621d4
feat: rm shutdown flag
wathenjiang 5b010bc
rm benches/spawn_concurrent.rs because it is unstable now in tokio
wathenjiang 66fa190
use get_unchecked to get segment lock
wathenjiang 2ac0b96
feat: drop lock promptly and explicitly
wathenjiang 47820b3
feat: move the atomic operations of count into the lock
wathenjiang d0acd70
Merge branch 'master' into reduce-lock-contention
wathenjiang 7ef0265
first commit
wathenjiang 01da1ed
add Safety
wathenjiang 6f5eaa2
mutable ref to immutable ref
wathenjiang 3257cb7
use std AtomicUsize
wathenjiang 7b101ee
fix: count sub in pop_back
wathenjiang 608d2c6
refactor doube check closed flag in bind_inner
wathenjiang 1c214e0
cast task_id to usize
wathenjiang e24db6d
use ShardGuard
wathenjiang 3c90918
update comments
wathenjiang cd5fb20
update comments
wathenjiang 38c9eba
fix: remove needless reference
wathenjiang 7968b51
fix: release lock as far as possible
wathenjiang 5d3da9e
Update tokio/src/runtime/task/list.rs
wathenjiang 1d1a7a3
Update tokio/src/util/sharded_list.rs
wathenjiang 13c4b93
Update tokio/src/util/sharded_list.rs
wathenjiang ee53e23
Update tokio/src/util/sharded_list.rs
wathenjiang 01afd7b
Update tokio/src/util/sharded_list.rs
wathenjiang 36c2355
Update tokio/src/util/sharded_list.rs
wathenjiang d6606b8
Update tokio/src/util/sharded_list.rs
wathenjiang c9f32d2
Update tokio/src/runtime/task/list.rs
wathenjiang bbefb70
fix: accept ownedship of closue in method for_each of OwnedTasks
wathenjiang f97748c
Merge branch 'master' into reduce-lock-contention
wathenjiang 8baf79e
Apply suggestions from code review
wathenjiang 87e70c3
Apply suggestions from code review
wathenjiang af92f20
Apply suggestions from code review
wathenjiang 60104b8
Apply suggestions from code review
wathenjiang bb4458b
rm unused push method
wathenjiang 1adad70
rename get_sharded_id to get_shard_id
wathenjiang ef8d2b7
Apply suggestions from code review
wathenjiang 2d4fbf6
rename get_sharded_id to get_shard_id
wathenjiang 777d97e
add sentence in comments
wathenjiang 5406a7e
rm dead_code attr
wathenjiang c9b05ee
Merge branch 'master' into reduce-lock-contention
wathenjiang 680848e
move spawn_concurrent_level size from shardedList to builder
wathenjiang 6fb70b1
update comments
wathenjiang 0ba87db
update comments
wathenjiang 8bb106f
update comments
wathenjiang e0fb9e2
rm loop in ShardedList::new
wathenjiang 57133a5
fix rustfmt
wathenjiang 71e8983
fix
wathenjiang d1ce613
fix spawn_concurrency_level
wathenjiang e6b8db1
fix spawn_concurrency_level
wathenjiang 592f432
rm get_spawn_concurrency_level to cfg_rt_multi_thread
wathenjiang f083757
add allow(dead_code))]
wathenjiang 3105af7
rm dead_code attr
wathenjiang 8e189cf
make spawn_concurrency_level unconfigurable
wathenjiang 75d3081
Apply suggestions from code review
wathenjiang ed27f70
apply suggestions from core review
wathenjiang db58076
move get_spawn_concurrency_level from builder to task/list.rs
wathenjiang 06656b9
feat: add comments and rm loom cfg
wathenjiang caa74c9
feat: update comments for gen_shared_list_size
wathenjiang 865de08
feat: update comments for gen_shared_list_size
wathenjiang 7a76ad5
Apply suggestions from code review
wathenjiang 78d1dea
fix: fmt and typo fix
wathenjiang 3844bd3
Update tokio/src/util/sharded_list.rs
Darksonn 038650f
Merge branch 'master' into reduce-lock-contention
Darksonn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It's not clear to me that we want a configuration option for this. At least, it should be unstable.
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.
This is as I said above:
I thinke make it unstable is a good decision.
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.
I have made it unstable, and it seems that unstable features can not be tested in
benches
crate, so I removebenches/spawn_current.rs
temporarily.The benchmark test of parameter
spawn_concurrency_level
under different values is in github hidden items now: #6001 (comment)