mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu-mainline.git
				synced 2025-03-21 01:53:15 +00:00 
			
		
		
		
	Scheduler: Corrections to YieldAndBalanceLoad and Yield bombing protection.
This commit is contained in:
		
							parent
							
								
									b49c0dab87
								
							
						
					
					
						commit
						2d382de6fa
					
				@ -165,12 +165,12 @@ bool GlobalScheduler::YieldThreadAndBalanceLoad(Thread* yielding_thread) {
 | 
				
			|||||||
                    continue;
 | 
					                    continue;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (next_thread->GetLastRunningTicks() >= thread->GetLastRunningTicks() ||
 | 
					        }
 | 
				
			||||||
                next_thread->GetPriority() < thread->GetPriority()) {
 | 
					        if (next_thread->GetLastRunningTicks() >= thread->GetLastRunningTicks() ||
 | 
				
			||||||
                if (thread->GetPriority() <= priority) {
 | 
					            next_thread->GetPriority() < thread->GetPriority()) {
 | 
				
			||||||
                    winner = thread;
 | 
					            if (thread->GetPriority() <= priority) {
 | 
				
			||||||
                    break;
 | 
					                winner = thread;
 | 
				
			||||||
                }
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -240,7 +240,7 @@ bool GlobalScheduler::YieldThreadAndWaitForLoadBalancing(Thread* yielding_thread
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void GlobalScheduler::PreemptThreads() {
 | 
					void GlobalScheduler::PreemptThreads() {
 | 
				
			||||||
    for (std::size_t core_id = 0; core_id < NUM_CPU_CORES; core_id++) {
 | 
					    for (std::size_t core_id = 0; core_id < NUM_CPU_CORES; core_id++) {
 | 
				
			||||||
        const u64 priority = preemption_priorities[core_id];
 | 
					        const u32 priority = preemption_priorities[core_id];
 | 
				
			||||||
        if (scheduled_queue[core_id].size(priority) > 1) {
 | 
					        if (scheduled_queue[core_id].size(priority) > 1) {
 | 
				
			||||||
            scheduled_queue[core_id].yield(priority);
 | 
					            scheduled_queue[core_id].yield(priority);
 | 
				
			||||||
            reselection_pending.store(true, std::memory_order_release);
 | 
					            reselection_pending.store(true, std::memory_order_release);
 | 
				
			||||||
 | 
				
			|||||||
@ -155,7 +155,7 @@ private:
 | 
				
			|||||||
    std::array<Common::MultiLevelQueue<Thread*, THREADPRIO_COUNT>, NUM_CPU_CORES> suggested_queue;
 | 
					    std::array<Common::MultiLevelQueue<Thread*, THREADPRIO_COUNT>, NUM_CPU_CORES> suggested_queue;
 | 
				
			||||||
    std::atomic<bool> reselection_pending;
 | 
					    std::atomic<bool> reselection_pending;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::array<u64, NUM_CPU_CORES> preemption_priorities = {59, 59, 59, 62};
 | 
					    std::array<u32, NUM_CPU_CORES> preemption_priorities = {59, 59, 59, 62};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Lists all thread ids that aren't deleted/etc.
 | 
					    /// Lists all thread ids that aren't deleted/etc.
 | 
				
			||||||
    std::vector<SharedPtr<Thread>> thread_list;
 | 
					    std::vector<SharedPtr<Thread>> thread_list;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user