mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Simple CPU affinity system
This commit is contained in:
parent
14aa071e7f
commit
5e72d81a8f
@ -140,6 +140,9 @@ namespace Tasking
|
|||||||
if (tcb->Status != TaskStatus::Ready)
|
if (tcb->Status != TaskStatus::Ready)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (tcb->Info.Affinity[CurrentCPU->ID] == false)
|
||||||
|
continue;
|
||||||
|
|
||||||
CurrentCPU->CurrentProcess = pcb;
|
CurrentCPU->CurrentProcess = pcb;
|
||||||
CurrentCPU->CurrentThread = tcb;
|
CurrentCPU->CurrentThread = tcb;
|
||||||
return true;
|
return true;
|
||||||
@ -178,6 +181,9 @@ namespace Tasking
|
|||||||
goto RetryAnotherThread;
|
goto RetryAnotherThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thread->Info.Affinity[CurrentCPU->ID] == false)
|
||||||
|
continue;
|
||||||
|
|
||||||
CurrentCPU->CurrentThread = thread;
|
CurrentCPU->CurrentThread = thread;
|
||||||
gnat_schedbg("[thd 0 -> end] Scheduling thread %d parent of %s->%d Procs %d", thread->ID, thread->Parent->Name, CurrentCPU->CurrentProcess->Threads.size(), ListProcess.size());
|
gnat_schedbg("[thd 0 -> end] Scheduling thread %d parent of %s->%d Procs %d", thread->ID, thread->Parent->Name, CurrentCPU->CurrentProcess->Threads.size(), ListProcess.size());
|
||||||
return true;
|
return true;
|
||||||
@ -238,6 +244,9 @@ namespace Tasking
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tcb->Info.Affinity[CurrentCPU->ID] == false)
|
||||||
|
continue;
|
||||||
|
|
||||||
CurrentCPU->CurrentProcess = pcb;
|
CurrentCPU->CurrentProcess = pcb;
|
||||||
CurrentCPU->CurrentThread = tcb;
|
CurrentCPU->CurrentThread = tcb;
|
||||||
gnap_schedbg("[cur proc+1 -> first thd] Scheduling thread %d %s->%d (Total Procs %d)", tcb->ID, tcb->Name, pcb->Threads.size(), ListProcess.size());
|
gnap_schedbg("[cur proc+1 -> first thd] Scheduling thread %d %s->%d (Total Procs %d)", tcb->ID, tcb->Name, pcb->Threads.size(), ListProcess.size());
|
||||||
@ -290,6 +299,9 @@ namespace Tasking
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tcb->Info.Affinity[CurrentCPU->ID] == false)
|
||||||
|
continue;
|
||||||
|
|
||||||
CurrentCPU->CurrentProcess = pcb;
|
CurrentCPU->CurrentProcess = pcb;
|
||||||
CurrentCPU->CurrentThread = tcb;
|
CurrentCPU->CurrentThread = tcb;
|
||||||
sspt_schedbg("[proc 0 -> end -> first thd] Scheduling thread %d parent of %s->%d (Procs %d)", tcb->ID, tcb->Parent->Name, pcb->Threads.size(), ListProcess.size());
|
sspt_schedbg("[proc 0 -> end -> first thd] Scheduling thread %d parent of %s->%d (Procs %d)", tcb->ID, tcb->Parent->Name, pcb->Threads.size(), ListProcess.size());
|
||||||
|
@ -741,8 +741,8 @@ namespace Tasking
|
|||||||
{
|
{
|
||||||
SmartCriticalSection(TaskingLock);
|
SmartCriticalSection(TaskingLock);
|
||||||
#if defined(__amd64__)
|
#if defined(__amd64__)
|
||||||
for (int i = 0; i < SMP::CPUCores; i++)
|
// Map the IRQ16 to the first CPU.
|
||||||
((APIC::APIC *)Interrupts::apic[i])->RedirectIRQ(i, CPU::x86::IRQ16 - CPU::x86::IRQ0, 1);
|
((APIC::APIC *)Interrupts::apic[0])->RedirectIRQ(0, CPU::x86::IRQ16 - CPU::x86::IRQ0, 1);
|
||||||
#elif defined(__i386__)
|
#elif defined(__i386__)
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
#endif
|
#endif
|
||||||
@ -812,7 +812,9 @@ namespace Tasking
|
|||||||
sprintf(IdleName, "Idle Thread %d", i);
|
sprintf(IdleName, "Idle Thread %d", i);
|
||||||
IdleThread->Rename(IdleName);
|
IdleThread->Rename(IdleName);
|
||||||
IdleThread->SetPriority(Idle);
|
IdleThread->SetPriority(Idle);
|
||||||
break;
|
for (int j = 0; j < MAX_CPU; j++)
|
||||||
|
IdleThread->Info.Affinity[j] = false;
|
||||||
|
IdleThread->Info.Affinity[i] = true;
|
||||||
}
|
}
|
||||||
debug("Tasking Started");
|
debug("Tasking Started");
|
||||||
#if defined(__amd64__)
|
#if defined(__amd64__)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user