kernel: Force high priority threads to yield less often
This commit is contained in:
@@ -116,8 +116,9 @@ simple_get_effective_priority(Thread *thread)
|
|||||||
|
|
||||||
int32 effectivePriority = thread->priority;
|
int32 effectivePriority = thread->priority;
|
||||||
if (effectivePriority < B_FIRST_REAL_TIME_PRIORITY) {
|
if (effectivePriority < B_FIRST_REAL_TIME_PRIORITY) {
|
||||||
if (schedulerThreadData->forced_yield_count
|
const int kYieldFrequency = 1 << (min_c(thread->priority, 25) / 5 + 1);
|
||||||
&& schedulerThreadData->forced_yield_count % 16 == 0) {
|
if (schedulerThreadData->forced_yield_count != 0
|
||||||
|
&& schedulerThreadData->forced_yield_count % kYieldFrequency == 0) {
|
||||||
TRACE("forcing thread %ld to yield\n", thread->id);
|
TRACE("forcing thread %ld to yield\n", thread->id);
|
||||||
effectivePriority = B_LOWEST_ACTIVE_PRIORITY;
|
effectivePriority = B_LOWEST_ACTIVE_PRIORITY;
|
||||||
} else
|
} else
|
||||||
|
|||||||
Reference in New Issue
Block a user