mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:12:43 +00:00 
			
		
		
		
	Kernel/SMP: Process the deferred call queue in exit_trap()
We were previously relying on a side effect of the critical section in smp_process_pending_messages(): when exiting that section, it would process any pending deferred calls. Instead of relying on that, make the deferred invocations explicit by calling deferred_call_execute_pending() in exit_trap(). This ensures that deferred calls get processed before entering the scheduler at the end of exit_trap(). Since thread unblocking happens via deferred calls, the threads don't have to wait until the next scheduling opportunity when they could be ready *now*. :^) This was the main reason Tom's SMP branch ran slowly in non-SMP mode.
This commit is contained in:
		
							parent
							
								
									57a7dfbd28
								
							
						
					
					
						commit
						a971de89d3
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -616,6 +616,10 @@ void Processor::exit_trap(TrapFrame& trap) | |||
|     if (s_smp_enabled) | ||||
|         smp_process_pending_messages(); | ||||
| 
 | ||||
|     // Process the deferred call queue. Among other things, this ensures
 | ||||
|     // that any pending thread unblocks happen before we enter the scheduler.
 | ||||
|     deferred_call_execute_pending(); | ||||
| 
 | ||||
|     auto* current_thread = Processor::current_thread(); | ||||
|     if (current_thread) { | ||||
|         auto& current_trap = current_thread->current_trap(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling