diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-12-04 03:22:09 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-12-04 03:22:09 +0100 |
commit | ddf5903cd9c05f1fecd8a5b8e8ad702b9b20eef8 (patch) | |
tree | c5bf32930463f7e072689061f73b73e360924aad /src/core | |
parent | scheduler: Only work steal higher priority threads from other cores (diff) | |
download | yuzu-ddf5903cd9c05f1fecd8a5b8e8ad702b9b20eef8.tar yuzu-ddf5903cd9c05f1fecd8a5b8e8ad702b9b20eef8.tar.gz yuzu-ddf5903cd9c05f1fecd8a5b8e8ad702b9b20eef8.tar.bz2 yuzu-ddf5903cd9c05f1fecd8a5b8e8ad702b9b20eef8.tar.lz yuzu-ddf5903cd9c05f1fecd8a5b8e8ad702b9b20eef8.tar.xz yuzu-ddf5903cd9c05f1fecd8a5b8e8ad702b9b20eef8.tar.zst yuzu-ddf5903cd9c05f1fecd8a5b8e8ad702b9b20eef8.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 18 | ||||
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index c6b7d5232..df4d6cf0a 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp @@ -200,7 +200,6 @@ void Scheduler::YieldWithoutLoadBalancing(Thread* thread) { // Yield this thread -- sleep for zero time and force reschedule to different thread WaitCurrentThread_Sleep(); GetCurrentThread()->WakeAfterDelay(0); - Reschedule(); } void Scheduler::YieldWithLoadBalancing(Thread* thread) { @@ -223,24 +222,23 @@ void Scheduler::YieldWithLoadBalancing(Thread* thread) { // Search through all of the cpu cores (except this one) for a suggested thread. // Take the first non-nullptr one for (unsigned cur_core = 0; cur_core < Core::NUM_CPU_CORES; ++cur_core) { - if (cur_core == core) - continue; - const auto res = Core::System::GetInstance().CpuCore(cur_core).Scheduler().GetNextSuggestedThread( core, priority); - if (res != nullptr && - (suggested_thread == nullptr || suggested_thread->GetPriority() > res->GetPriority())) { - suggested_thread = res; + + // If scheduler provides a suggested thread + if (res != nullptr) { + // And its better than the current suggested thread (or is the first valid one) + if (suggested_thread == nullptr || + suggested_thread->GetPriority() > res->GetPriority()) { + suggested_thread = res; + } } } // If a suggested thread was found, queue that for this core if (suggested_thread != nullptr) suggested_thread->ChangeCore(core, suggested_thread->GetAffinityMask()); - - // Perform actual yielding. - Reschedule(); } void Scheduler::YieldAndWaitForLoadBalancing(Thread* thread) { diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index fabdedd3d..29c2c2d03 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -994,7 +994,9 @@ static void SleepThread(s64 nanoseconds) { GetCurrentThread()->WakeAfterDelay(nanoseconds); } - Core::System::GetInstance().PrepareReschedule(); + // Reschedule all CPU cores + for (std::size_t i = 0; i < 4; ++i) + Core::System::GetInstance().CpuCore(i).PrepareReschedule(); } /// Wait process wide key atomic |