mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-17 21:16:38 +00:00
c1ed150949
* Kernel: Wake cores from idle directly rather than through a host thread Right now when a core enters an idle state, leaving that idle state requires us to first signal the core's idle thread, which then signals the correct thread that we want to run on the core. This means that in a lot of cases, we're paying double for a thread to be woken from an idle state. This PR moves this process to happen on the thread that is waking others out of idle, instead of an idle thread that needs to be woken first. For compatibility the process has been kept as similar as possible - the process for IdleThreadLoop has been migrated to TryLeaveIdle, and is gated by a condition variable that lets it run only once at a time for each core. A core is only considered for wake from idle if idle is both active and has been signalled - the signal is consumed and the active state is cleared when the core leaves idle. Dummy threads (just the idle thread at the moment) have been changed to have no host thread, as the work is now done by threads entering idle and signalling out of it. This could put a bit of extra work on threads that would have triggered `_idleInterruptEvent` before, but I'd expect less work than signalling all those reset events and the OS overhead that follows. Worst case is that other threads performing these signals at the same time will have to wait for each other, but it's still going to be a very short amount of time. Improvements are best seen in games with heavy (or very misguided) multithreading, such as Pokemon: Legends Arceus. Improvements are expected in Scarlet/Violet and TOTK, but are harder to measure. Testing on Linux/MacOS still to be done, definitely need to test more games as this affects all of them (obviously) and any issues might be rare to encounter. * Remove _idleThread entirely * Use spinwait so we don't completely blast the CPU with cmpxchg * Didn't I already do this * Cleanup |
||
---|---|---|
.. | ||
Exceptions | ||
FileSystem | ||
HOS | ||
Loaders | ||
UI | ||
Utilities | ||
AssemblyInfo.cs | ||
HLEConfiguration.cs | ||
Homebrew.npdm | ||
MemoryConfiguration.cs | ||
PerformanceStatistics.cs | ||
Ryujinx.HLE.csproj | ||
Switch.cs |