diff options
| author | 2018-12-02 00:44:40 -0500 | |
|---|---|---|
| committer | 2018-12-02 00:44:40 -0500 | |
| commit | 3476830b26b61410b633c827e985bffa1dc52528 (patch) | |
| tree | cedba8440c12c3d8edeb78f33de5c56f2488b60f /src/core/hle/kernel/svc.cpp | |
| parent | scheduler: Add explanations for YieldWith and WithoutLoadBalancing (diff) | |
| download | yuzu-3476830b26b61410b633c827e985bffa1dc52528.tar.gz yuzu-3476830b26b61410b633c827e985bffa1dc52528.tar.xz yuzu-3476830b26b61410b633c827e985bffa1dc52528.zip | |
svc: Avoid performance-degrading unnecessary reschedule
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 205706033..c119f7be1 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -962,13 +962,13 @@ static void SleepThread(s64 nanoseconds) { | |||
| 962 | 962 | ||
| 963 | // Don't attempt to yield execution if there are no available threads to run, | 963 | // Don't attempt to yield execution if there are no available threads to run, |
| 964 | // this way we avoid a useless reschedule to the idle thread. | 964 | // this way we avoid a useless reschedule to the idle thread. |
| 965 | if (!Core::System::GetInstance().CurrentScheduler().HaveReadyThreads()) | 965 | if (nanoseconds <= 0 && !Core::System::GetInstance().CurrentScheduler().HaveReadyThreads()) |
| 966 | return; | 966 | return; |
| 967 | 967 | ||
| 968 | enum class SleepType : s64 { | 968 | enum class SleepType : s64 { |
| 969 | YieldWithoutLoadBalancing = 0, | 969 | YieldWithoutLoadBalancing = 0, |
| 970 | YieldWithLoadBalancing = 1, | 970 | YieldWithLoadBalancing = -1, |
| 971 | YieldAndWaitForLoadBalancing = 2, | 971 | YieldAndWaitForLoadBalancing = -2, |
| 972 | }; | 972 | }; |
| 973 | 973 | ||
| 974 | if (nanoseconds <= 0) { | 974 | if (nanoseconds <= 0) { |
| @@ -998,10 +998,7 @@ static void SleepThread(s64 nanoseconds) { | |||
| 998 | // Create an event to wake the thread up after the specified nanosecond delay has passed | 998 | // Create an event to wake the thread up after the specified nanosecond delay has passed |
| 999 | GetCurrentThread()->WakeAfterDelay(nanoseconds); | 999 | GetCurrentThread()->WakeAfterDelay(nanoseconds); |
| 1000 | 1000 | ||
| 1001 | Core::System::GetInstance().CpuCore(0).PrepareReschedule(); | 1001 | Core::System::GetInstance().PrepareReschedule(); |
| 1002 | Core::System::GetInstance().CpuCore(1).PrepareReschedule(); | ||
| 1003 | Core::System::GetInstance().CpuCore(2).PrepareReschedule(); | ||
| 1004 | Core::System::GetInstance().CpuCore(3).PrepareReschedule(); | ||
| 1005 | } | 1002 | } |
| 1006 | 1003 | ||
| 1007 | /// Wait process wide key atomic | 1004 | /// Wait process wide key atomic |