scheduler: Only unassign a thread's core if it is not pinned

If a pinned thread is being run while disabling a CPU core, the thread
is properly requeued to that core, but with fCore set to NULL, causing
the scheduler to panic the next time that thread is rescheduled.

Change-Id: I9cf18c5a470517124b2573347cf3eb6fd26ab7b6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6917
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Puck Meerburg
2023-10-07 01:56:40 +00:00
committed by waddlesplash
parent 81c282f4b5
commit 163053a45c
+6 -2
View File
@@ -381,8 +381,12 @@ reschedule(int32 nextState)
ThreadData* nextThreadData;
if (gCPU[thisCPU].disabled) {
if (!oldThreadData->IsIdle()) {
putOldThreadAtBack = oldThread->pinned_to_cpu == 0;
oldThreadData->UnassignCore(true);
if (oldThread->pinned_to_cpu == 0) {
putOldThreadAtBack = true;
oldThreadData->UnassignCore(true);
} else {
putOldThreadAtBack = false;
}
CPURunQueueLocker cpuLocker(cpu);
nextThreadData = cpu->PeekIdleThread();