Skip to content
Snippets Groups Projects
Commit 9e3d97c0 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

[AbstractWorkStealingScheduler] Check AnywhereQueue after a few steals

parent 2a4bd942
No related branches found
No related tags found
1 merge request!196Batch dequeue from AnywhereQueue
......@@ -131,8 +131,13 @@ popBottom:
}
{
// TODO: Determine if there is a better value than 1/3.
const float CHECK_ANYWHERE_QUEUE_AT_PERCENTAGE = 0.33;
const workerid_t myWorkerId = Runtime::getWorkerId();
const workerid_t workerCount = runtime.getWorkerCount();
// NOLINTNEXTLINE(bugprone-narrowing-conversions)
const workerid_t checkAnywhereQueueAt = workerCount * CHECK_ANYWHERE_QUEUE_AT_PERCENTAGE;
workerid_t startWorkerId = Runtime::rand() % workerCount;
// TODO: See how reducing the loop bound affects things.
for (workerid_t i = 0; i < workerCount; ++i) {
......@@ -151,6 +156,13 @@ popBottom:
fiberSource = FiberSource::stolen;
goto out;
}
// If we failed to steal from a certain number of victims, check
// the anywhere queue for new fibers.
if (i == checkAnywhereQueueAt) {
auto anywhereQueueFiber = nextFiberViaAnywhereQueue();
if (anywhereQueueFiber) return *anywhereQueueFiber;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment