Skip to content
Snippets Groups Projects

Smooth out thread unparking spikes

Closed Peter Cai requested to merge p5cai/libfibre:patch-thundering-herd into master
4 files
+ 48
4
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -101,12 +101,16 @@ void BaseProcessor::idleLoop(Fred* initFred) {
}
Fred& BaseProcessor::scheduleFull(_friend<Fred>) {
scheduler.idleManager.transitionToSpinning();
for (size_t i = 0; i < IdleSpinMax; i += 1) {
#if TESTING_LOADBALANCING
if (scheduler.idleManager.tryGetReadyFred()) {
for (;;) {
Fred* nextFred = scheduleInternal();
if (nextFred) return *nextFred;
if (nextFred) {
scheduler.idleManager.transitionFromSpinning();
return *nextFred;
}
}
}
#else /* TESTING_LOADBALANCING */
@@ -117,6 +121,7 @@ Fred& BaseProcessor::scheduleFull(_friend<Fred>) {
}
#endif
}
scheduler.idleManager.transitionFromSpinning();
return *idleFred;
}
Loading