@@ -465,8 +465,8 @@ bool Scheduler::pick_next()
465
465
});
466
466
467
467
#ifdef SCHEDULER_RUNNABLE_DEBUG
468
- dbg () << " Non-runnables:" ;
469
- Scheduler::for_each_nonrunnable ([](Thread& thread) -> IterationDecision {
468
+ dbg () << " Scheduler[ " << Processor::current (). id () << " ]: Non-runnables:" ;
469
+ Scheduler::for_each_nonrunnable ([& ](Thread& thread) -> IterationDecision {
470
470
if (thread.state () == Thread::Queued)
471
471
dbg () << " " << String::format (" %-12s" , thread.state_string ()) << " " << thread << " @ " << String::format (" %w" , thread.tss ().cs ) << " :" << String::format (" %x" , thread.tss ().eip ) << " Reason: " << (thread.wait_reason () ? thread.wait_reason () : " none" );
472
472
else if (thread.state () == Thread::Dying)
@@ -476,7 +476,7 @@ bool Scheduler::pick_next()
476
476
return IterationDecision::Continue;
477
477
});
478
478
479
- dbg () << " Runnables:" ;
479
+ dbg () << " Scheduler[ " << Processor::current (). id () << " ]: Runnables:" ;
480
480
Scheduler::for_each_runnable ([](Thread& thread) -> IterationDecision {
481
481
dbg () << " " << String::format (" %3u" , thread.effective_priority ()) << " /" << String::format (" %2u" , thread.priority ()) << " " << String::format (" %-12s" , thread.state_string ()) << " " << thread << " @ " << String::format (" %w" , thread.tss ().cs ) << " :" << String::format (" %x" , thread.tss ().eip );
482
482
return IterationDecision::Continue;
@@ -487,8 +487,11 @@ bool Scheduler::pick_next()
487
487
488
488
Vector<Thread*, 128 > sorted_runnables;
489
489
for_each_runnable ([&](auto & thread) {
490
- if ((thread.affinity () & (1u << Processor::current ().id ())) != 0 )
491
- sorted_runnables.append (&thread);
490
+ if ((thread.affinity () & (1u << Processor::current ().id ())) == 0 )
491
+ return IterationDecision::Continue;
492
+ if (thread.state () == Thread::Running && &thread != current_thread)
493
+ return IterationDecision::Continue;
494
+ sorted_runnables.append (&thread);
492
495
if (&thread == scheduler_data.m_pending_beneficiary ) {
493
496
thread_to_schedule = &thread;
494
497
return IterationDecision::Break;
0 commit comments