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

This commit is contained in:
Pawel Dziepak 2013-12-31 04:48:23 +01:00
parent 135bb9c959
commit db1ddabfd0
2 changed files with 4 additions and 6 deletions

View File

@ -532,6 +532,9 @@ reschedule(int32 nextState)
}
Thread* nextThread = nextThreadData->GetThread();
ASSERT(!gCPU[thisCPU].disabled || thread_is_idle_thread(nextThread));
// update CPU heap
CoreCPUHeapLocker cpuLocker(core);
cpu->UpdatePriority(nextThreadData->GetEffectivePriority());
cpuLocker.Unlock();
@ -559,11 +562,6 @@ reschedule(int32 nextState)
ASSERT(nextThreadData->Core() == core);
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())
update_thread_times(oldThread, nextThread);

View File

@ -210,7 +210,7 @@ ThreadData::_ChooseCPU(CoreEntry* core, bool& rescheduleNeeded) const
if (fThread->previous_cpu != NULL) {
CPUEntry* previousCPU = &gCPUEntries[fThread->previous_cpu->cpu_num];
if (previousCPU->Core() == core) {
if (previousCPU->Core() == core && !fThread->previous_cpu->disabled) {
CoreCPUHeapLocker _(core);
if (CPUPriorityHeap::GetKey(previousCPU) < threadPriority) {
previousCPU->UpdatePriority(threadPriority);