scheduler: Increase thread penalty at fork

This commit is contained in:
Pawel Dziepak 2014-01-09 03:48:48 +01:00
parent a2634874ed
commit 082d3c1015
2 changed files with 8 additions and 3 deletions

View File

@ -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;

View File

@ -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;