scheduler: Increase penalty of waiting threads
The fact that thread is waiting doesn't mean that it is nice to the others. If the thread, indeed, waits for a longer time its penalty will be cancelled anyway, however if the thread waits for a very short time do not count that as being nice since lower priority threads didn't have much chance to run.
This commit is contained in:
parent
45ff530069
commit
1df2e75540
@ -728,7 +728,7 @@ is_task_small(Thread* thread)
|
|||||||
{
|
{
|
||||||
int32 priority = get_effective_priority(thread);
|
int32 priority = get_effective_priority(thread);
|
||||||
int32 penalty = thread->scheduler_data->priority_penalty;
|
int32 penalty = thread->scheduler_data->priority_penalty;
|
||||||
return penalty == 0 || priority >= B_DISPLAY_PRIORITY;
|
return penalty < 2 || priority >= B_DISPLAY_PRIORITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1244,10 +1244,8 @@ _scheduler_reschedule(void)
|
|||||||
|
|
||||||
// update CPU heap so that old thread would have CPU properly chosen
|
// update CPU heap so that old thread would have CPU properly chosen
|
||||||
Thread* nextThread = sRunQueues[thisCore].PeekMaximum();
|
Thread* nextThread = sRunQueues[thisCore].PeekMaximum();
|
||||||
if (nextThread != NULL) {
|
if (nextThread != NULL)
|
||||||
update_priority_heaps(thisCPU,
|
update_priority_heaps(thisCPU, get_effective_priority(nextThread));
|
||||||
get_effective_priority(nextThread));
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (oldThread->next_state) {
|
switch (oldThread->next_state) {
|
||||||
case B_THREAD_RUNNING:
|
case B_THREAD_RUNNING:
|
||||||
@ -1271,6 +1269,7 @@ _scheduler_reschedule(void)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case B_THREAD_SUSPENDED:
|
case B_THREAD_SUSPENDED:
|
||||||
|
increase_penalty(oldThread);
|
||||||
thread_goes_away(oldThread);
|
thread_goes_away(oldThread);
|
||||||
TRACE("reschedule(): suspending thread %ld\n", oldThread->id);
|
TRACE("reschedule(): suspending thread %ld\n", oldThread->id);
|
||||||
break;
|
break;
|
||||||
@ -1278,6 +1277,7 @@ _scheduler_reschedule(void)
|
|||||||
thread_goes_away(oldThread);
|
thread_goes_away(oldThread);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
increase_penalty(oldThread);
|
||||||
thread_goes_away(oldThread);
|
thread_goes_away(oldThread);
|
||||||
TRACE("not enqueueing thread %ld into run queue next_state = %ld\n",
|
TRACE("not enqueueing thread %ld into run queue next_state = %ld\n",
|
||||||
oldThread->id, oldThread->next_state);
|
oldThread->id, oldThread->next_state);
|
||||||
|
Loading…
Reference in New Issue
Block a user