diff --git a/src/system/kernel/scheduler/scheduler_thread.cpp b/src/system/kernel/scheduler/scheduler_thread.cpp index f3c4983c2a..0ca3e50ea4 100644 --- a/src/system/kernel/scheduler/scheduler_thread.cpp +++ b/src/system/kernel/scheduler/scheduler_thread.cpp @@ -106,10 +106,16 @@ ThreadData::Init() { _InitBase(); - ThreadData* currentThreadData = thread_get_current_thread()->scheduler_data; + Thread* currentThread = thread_get_current_thread(); + ThreadData* currentThreadData = currentThread->scheduler_data; fCore = currentThreadData->fCore; if (fThread->priority < B_FIRST_REAL_TIME_PRIORITY) { + if (!thread_is_idle_thread(currentThread) + && currentThread->priority < B_FIRST_REAL_TIME_PRIORITY) { + currentThreadData->_IncreasePenalty(false); + } + fPriorityPenalty = std::min(currentThreadData->fPriorityPenalty, std::max(fThread->priority - _GetMinimalPriority(), int32(0))); fAdditionalPenalty = currentThreadData->fAdditionalPenalty; diff --git a/src/system/kernel/scheduler/scheduler_thread.h b/src/system/kernel/scheduler/scheduler_thread.h index 5d2af64849..26b1e43ba2 100644 --- a/src/system/kernel/scheduler/scheduler_thread.h +++ b/src/system/kernel/scheduler/scheduler_thread.h @@ -426,8 +426,7 @@ ThreadData::HasQuantumEnded(bool wasPreempted, bool hasYielded) fTimeLeft -= timeUsed; // too little time left, it's better make the next quantum a bit longer - int32 skipTime = gCurrentMode->minimal_quantum; - skipTime -= skipTime / 10; + int32 skipTime = gCurrentMode->minimal_quantum / 2; if (wasPreempted || fTimeLeft <= skipTime) { fStolenTime += fTimeLeft; fTimeLeft = 0;