summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2018-05-05 23:54:43 -0400
committerGravatar bunnei2018-05-10 19:34:52 -0400
commit8aa5d25f826c8969a1e9938d8c8e12fa6df8be82 (patch)
tree5e0832f4382787a889d3f0ed1ec75175a6ac8071
parentsvc: Implement GetThreadCoreMask and SetThreadCoreMask. (diff)
downloadyuzu-8aa5d25f826c8969a1e9938d8c8e12fa6df8be82.tar.gz
yuzu-8aa5d25f826c8969a1e9938d8c8e12fa6df8be82.tar.xz
yuzu-8aa5d25f826c8969a1e9938d8c8e12fa6df8be82.zip
threading: Reschedule only on cores that are necessary.
-rw-r--r--src/core/core.cpp5
-rw-r--r--src/core/core.h2
-rw-r--r--src/core/hle/kernel/svc.cpp4
-rw-r--r--src/core/hle/kernel/thread.cpp2
4 files changed, 10 insertions, 3 deletions
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) {
141 return cpu_cores[core_index]->ArmInterface(); 141 return cpu_cores[core_index]->ArmInterface();
142} 142}
143 143
144Cpu& System::CpuCore(size_t core_index) {
145 ASSERT(core_index < NUM_CPU_CORES);
146 return *cpu_cores[core_index];
147}
148
144System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { 149System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
145 NGLOG_DEBUG(HW_Memory, "initialized OK"); 150 NGLOG_DEBUG(HW_Memory, "initialized OK");
146 151
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:
114 114
115 ARM_Interface& ArmInterface(size_t core_index); 115 ARM_Interface& ArmInterface(size_t core_index);
116 116
117 Cpu& CpuCore(size_t core_index);
118
117 Tegra::GPU& GPU() { 119 Tegra::GPU& GPU() {
118 return *gpu_core; 120 return *gpu_core;
119 } 121 }
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
625 625
626 // Note: Deliberately don't attempt to inherit the lock owner's priority. 626 // Note: Deliberately don't attempt to inherit the lock owner's priority.
627 627
628 Core::System::GetInstance().PrepareReschedule(); 628 Core::System::GetInstance().CpuCore(current_thread->processor_id).PrepareReschedule();
629 return RESULT_SUCCESS; 629 return RESULT_SUCCESS;
630} 630}
631 631
@@ -678,7 +678,7 @@ static ResultCode SignalProcessWideKey(VAddr condition_variable_addr, s32 target
678 678
679 owner->AddMutexWaiter(thread); 679 owner->AddMutexWaiter(thread);
680 680
681 Core::System::GetInstance().PrepareReschedule(); 681 Core::System::GetInstance().CpuCore(thread->processor_id).PrepareReschedule();
682 } 682 }
683 683
684 ++processed; 684 ++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() {
189 189
190 status = THREADSTATUS_READY; 190 status = THREADSTATUS_READY;
191 scheduler->ScheduleThread(this, current_priority); 191 scheduler->ScheduleThread(this, current_priority);
192 Core::System::GetInstance().PrepareReschedule(); 192 Core::System::GetInstance().CpuCore(processor_id).PrepareReschedule();
193} 193}
194 194
195/** 195/**