Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MB-18453: Make task scheduling fairer
The MB identified that we can starve tasks by scheduling a higher priority task via ExecutorPool::wake(). This occurs because ExecutorPool::wake() pushes tasks into the readyQueue enabling frequent wakes to trigger the starvation bug. The fix is to remove readyQueue.push from wake, so that we only push to the readyQueue. The fetch side of scheduling only looks at the futureQueue once the readyQueue is empty, thus the identified starvation won't happen. A unit-test demonstrates the fix using the single-threaded harness and expects that two tasks of differing priorities get executed, rather than the wake() starving the low-priority task. This test drives: - ExecutorPool::schedule - ExecutorPool::reschedule - ExecutorPool::wake These are all the methods which can add tasks into the scheduler queue. The fetch side is also covered: - ExecutorPool::fetchNextTask Change-Id: Ie797a637ce4e7066e3155751ff467bc65d083646 Reviewed-on: http://review.couchbase.org/65385 Well-Formed: buildbot <build@couchbase.com> Tested-by: buildbot <build@couchbase.com> Reviewed-by: Dave Rigby <daver@couchbase.com>
- Loading branch information
1 parent
cae60e3
commit e22c9eb
Showing
3 changed files
with
94 additions
and
3 deletions.
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