|
|
@ -165,6 +165,7 @@ bool GlobalScheduler::YieldThreadAndBalanceLoad(Thread* yielding_thread) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (next_thread->GetLastRunningTicks() >= thread->GetLastRunningTicks() ||
|
|
|
|
if (next_thread->GetLastRunningTicks() >= thread->GetLastRunningTicks() ||
|
|
|
|
next_thread->GetPriority() < thread->GetPriority()) {
|
|
|
|
next_thread->GetPriority() < thread->GetPriority()) {
|
|
|
|
if (thread->GetPriority() <= priority) {
|
|
|
|
if (thread->GetPriority() <= priority) {
|
|
|
@ -173,7 +174,6 @@ bool GlobalScheduler::YieldThreadAndBalanceLoad(Thread* yielding_thread) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (winner != nullptr) {
|
|
|
|
if (winner != nullptr) {
|
|
|
|
if (winner != yielding_thread) {
|
|
|
|
if (winner != yielding_thread) {
|
|
|
@ -240,7 +240,7 @@ bool GlobalScheduler::YieldThreadAndWaitForLoadBalancing(Thread* yielding_thread
|
|
|
|
|
|
|
|
|
|
|
|
void GlobalScheduler::PreemptThreads() {
|
|
|
|
void GlobalScheduler::PreemptThreads() {
|
|
|
|
for (std::size_t core_id = 0; core_id < NUM_CPU_CORES; core_id++) {
|
|
|
|
for (std::size_t core_id = 0; core_id < NUM_CPU_CORES; core_id++) {
|
|
|
|
const u64 priority = preemption_priorities[core_id];
|
|
|
|
const u32 priority = preemption_priorities[core_id];
|
|
|
|
if (scheduled_queue[core_id].size(priority) > 1) {
|
|
|
|
if (scheduled_queue[core_id].size(priority) > 1) {
|
|
|
|
scheduled_queue[core_id].yield(priority);
|
|
|
|
scheduled_queue[core_id].yield(priority);
|
|
|
|
reselection_pending.store(true, std::memory_order_release);
|
|
|
|
reselection_pending.store(true, std::memory_order_release);
|
|
|
|