This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Don't multiply YieldProcessor count by proc count (ManualResetEventSlim, Task) (#13556) #13631
Merged
Conversation
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
Port of dotnet#13556 to release/2.0.0 Related to issue mentioned in https://github.com/dotnet/coreclr/issues/13388 Fixes https://github.com/dotnet/coreclr/issues/13630 - Multipying the YieldProcessor count by proc count can cause excessive delays that are not fruitful on machines with a large number of procs. Even on a 12-proc machine (6-core), the heuristics as they are without the multiply seem to perform much better. - The issue above also mentions that the delay of PAUSE on Intel Skylake+ processors have a significantly larger delay (140 cycles vs 10 cycles). Simulating that by multiplying the YieldProcessor count by 14 shows that in both tests tested, it begins crawling at low thread counts. - I did most of the testing on ManualResetEventSlim, and since Task is using the same spin heuristics, applied the same change there as well.
stephentoub
approved these changes
Aug 28, 2017
Here are the perf numbers (from #13556), left is baseline and right is with this change. Xeon E5-1650 (Sandy Bridge, 6-core, 12-thread):
The slight regression on 64 * proc count threads is minor and going to be fixed in master. Core i7-6700 (Skylake, 4-core, 8-thread):
The spin loop is currently optimized for older processors, that'll be fixed in master as well. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Port of #13556 to release/2.0.0
Related to issue mentioned in https://github.com/dotnet/coreclr/issues/13388
Fixes https://github.com/dotnet/coreclr/issues/13630