-
Notifications
You must be signed in to change notification settings - Fork 32
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
steal other workers only before going to sleep #32
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Yilin Chen <[email protected]>
Signed-off-by: Yilin Chen <[email protected]>
How does it performs? |
Cool, what does criterion say? |
Criterion shows 5% to 20% regression while CPU time is reduced more than 50%. I have no idea what the regression comes from. I don't see imbalance among threads through |
I find the criterion microbenchmark is strongly associated with Although that's not the real case, I doubt if we really should yield. It is noticed many time that |
Not yield will lead to frequently sleep and awake. You should not just check spawn_many, but also other bench results. |
All microbenchmarks show improvements except
Yes, not yielding can lead to more frequent sleep and wake. But it's not that clear to me how it compares to some random scheduling among the OS. |
Very strange that I run benchmark on your code only ping_pong instead of spawn_many shows a significant regression, about 300%. |
Signed-off-by: Yilin Chen <[email protected]>
This PR is to mitigate the regression reported in tikv/tikv#7122 by changing the strategy of
pop
.It is found that CPU is mostly wasted in stealing other workers. The situation is especially terrible when there are lots of threads.
It makes little sense to steal other workers every time we call
pop
. We only need to make sure that the working threads never go to sleep while leaving other workers too busy. So we actually only need to steal other workers before going to sleep.