mirror of
https://github.com/PabloMK7/citra.git
synced 2024-12-01 19:59:38 +00:00
Kernel/Threads: Don't clear the CPU instruction cache when performing a context switch from an idle thread into a thread in the same process.
We were unnecessarily clearing the cache when going from Process A -> Idle -> Process A, this caused extreme performance regressions.
This commit is contained in:
parent
214150f00c
commit
b178089251
1 changed files with 3 additions and 1 deletions
|
@ -171,6 +171,8 @@ static void SwitchContext(Thread* new_thread) {
|
|||
// Cancel any outstanding wakeup events for this thread
|
||||
CoreTiming::UnscheduleEvent(ThreadWakeupEventType, new_thread->callback_handle);
|
||||
|
||||
auto previous_process = Kernel::g_current_process;
|
||||
|
||||
current_thread = new_thread;
|
||||
|
||||
ready_queue.remove(new_thread->current_priority, new_thread);
|
||||
|
@ -179,7 +181,7 @@ static void SwitchContext(Thread* new_thread) {
|
|||
Core::CPU().LoadContext(new_thread->context);
|
||||
Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
|
||||
|
||||
if (!previous_thread || previous_thread->owner_process != current_thread->owner_process) {
|
||||
if (previous_process != current_thread->owner_process) {
|
||||
Kernel::g_current_process = current_thread->owner_process;
|
||||
Memory::current_page_table = &Kernel::g_current_process->vm_manager.page_table;
|
||||
// We have switched processes and thus, page tables, clear the instruction cache so we
|
||||
|
|
Loading…
Reference in a new issue