scheduler: Thread can not stay on CPU if it has been disabled

This commit is contained in:
Pawel Dziepak
2013-12-31 04:49:45 +01:00
parent 135bb9c959
commit db1ddabfd0
2 changed files with 4 additions and 6 deletions
+3 -5
View File
@@ -532,6 +532,9 @@ reschedule(int32 nextState)
} }
Thread* nextThread = nextThreadData->GetThread(); Thread* nextThread = nextThreadData->GetThread();
ASSERT(!gCPU[thisCPU].disabled || thread_is_idle_thread(nextThread));
// update CPU heap
CoreCPUHeapLocker cpuLocker(core); CoreCPUHeapLocker cpuLocker(core);
cpu->UpdatePriority(nextThreadData->GetEffectivePriority()); cpu->UpdatePriority(nextThreadData->GetEffectivePriority());
cpuLocker.Unlock(); cpuLocker.Unlock();
@@ -559,11 +562,6 @@ reschedule(int32 nextState)
ASSERT(nextThreadData->Core() == core); ASSERT(nextThreadData->Core() == core);
nextThread->state = B_THREAD_RUNNING; nextThread->state = B_THREAD_RUNNING;
// update CPU heap
cpuLocker.Lock();
cpu->UpdatePriority(nextThreadData->GetEffectivePriority());
cpuLocker.Unlock();
// track kernel time (user time is tracked in thread_at_kernel_entry()) // track kernel time (user time is tracked in thread_at_kernel_entry())
update_thread_times(oldThread, nextThread); update_thread_times(oldThread, nextThread);
@@ -210,7 +210,7 @@ ThreadData::_ChooseCPU(CoreEntry* core, bool& rescheduleNeeded) const
if (fThread->previous_cpu != NULL) { if (fThread->previous_cpu != NULL) {
CPUEntry* previousCPU = &gCPUEntries[fThread->previous_cpu->cpu_num]; CPUEntry* previousCPU = &gCPUEntries[fThread->previous_cpu->cpu_num];
if (previousCPU->Core() == core) { if (previousCPU->Core() == core && !fThread->previous_cpu->disabled) {
CoreCPUHeapLocker _(core); CoreCPUHeapLocker _(core);
if (CPUPriorityHeap::GetKey(previousCPU) < threadPriority) { if (CPUPriorityHeap::GetKey(previousCPU) < threadPriority) {
previousCPU->UpdatePriority(threadPriority); previousCPU->UpdatePriority(threadPriority);