From 8aa5d25f826c8969a1e9938d8c8e12fa6df8be82 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 5 May 2018 23:54:43 -0400 Subject: threading: Reschedule only on cores that are necessary. --- src/core/core.cpp | 5 +++++ src/core/core.h | 2 ++ src/core/hle/kernel/svc.cpp | 4 ++-- src/core/hle/kernel/thread.cpp | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/core/core.cpp b/src/core/core.cpp index 59c8940f7..6cbfc3035 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -141,6 +141,11 @@ ARM_Interface& System::ArmInterface(size_t core_index) { return cpu_cores[core_index]->ArmInterface(); } +Cpu& System::CpuCore(size_t core_index) { + ASSERT(core_index < NUM_CPU_CORES); + return *cpu_cores[core_index]; +} + System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { NGLOG_DEBUG(HW_Memory, "initialized OK"); diff --git a/src/core/core.h b/src/core/core.h index 115061932..5740e858b 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -114,6 +114,8 @@ public: ARM_Interface& ArmInterface(size_t core_index); + Cpu& CpuCore(size_t core_index); + Tegra::GPU& GPU() { return *gpu_core; } diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 9050ff3de..89c3e240a 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -625,7 +625,7 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var // Note: Deliberately don't attempt to inherit the lock owner's priority. - Core::System::GetInstance().PrepareReschedule(); + Core::System::GetInstance().CpuCore(current_thread->processor_id).PrepareReschedule(); return RESULT_SUCCESS; } @@ -678,7 +678,7 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target owner->AddMutexWaiter(thread); - Core::System::GetInstance().PrepareReschedule(); + Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule(); } ++processed; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index c370776e8..31cf1551d 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -189,7 +189,7 @@ void Thread::ResumeFromWait() { status = THREADSTATUS_READY; scheduler->ScheduleThread(this, current_priority); - Core::System::GetInstance().PrepareReschedule(); + Core::System::GetInstance().CpuCore(processor_id).PrepareReschedule(); } /** -- cgit v1.2.3