scheduler: Increase thread penalty at fork

This commit is contained in:
Pawel Dziepak
2014-01-09 03:50:54 +01:00
parent a2634874ed
commit 082d3c1015
2 changed files with 8 additions and 3 deletions
@@ -106,10 +106,16 @@ ThreadData::Init()
{ {
_InitBase(); _InitBase();
ThreadData* currentThreadData = thread_get_current_thread()->scheduler_data; Thread* currentThread = thread_get_current_thread();
ThreadData* currentThreadData = currentThread->scheduler_data;
fCore = currentThreadData->fCore; fCore = currentThreadData->fCore;
if (fThread->priority < B_FIRST_REAL_TIME_PRIORITY) { 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, fPriorityPenalty = std::min(currentThreadData->fPriorityPenalty,
std::max(fThread->priority - _GetMinimalPriority(), int32(0))); std::max(fThread->priority - _GetMinimalPriority(), int32(0)));
fAdditionalPenalty = currentThreadData->fAdditionalPenalty; fAdditionalPenalty = currentThreadData->fAdditionalPenalty;
@@ -426,8 +426,7 @@ ThreadData::HasQuantumEnded(bool wasPreempted, bool hasYielded)
fTimeLeft -= timeUsed; fTimeLeft -= timeUsed;
// too little time left, it's better make the next quantum a bit longer // too little time left, it's better make the next quantum a bit longer
int32 skipTime = gCurrentMode->minimal_quantum; int32 skipTime = gCurrentMode->minimal_quantum / 2;
skipTime -= skipTime / 10;
if (wasPreempted || fTimeLeft <= skipTime) { if (wasPreempted || fTimeLeft <= skipTime) {
fStolenTime += fTimeLeft; fStolenTime += fTimeLeft;
fTimeLeft = 0; fTimeLeft = 0;