sched_ule(4): Fix interactive threads stealing.

In scenarios when first thread in the queue can migrate to specified
CPU, but later ones can't runq_steal_from() incorrectly returned NULL.

MFC after:	2 weeks
This commit is contained in:
Alexander Motin 2021-09-21 15:56:49 -04:00
parent 4f917847c9
commit bd84094a51

View File

@ -1110,10 +1110,12 @@ runq_steal_from(struct runq *rq, int cpu, u_char start)
continue;
rqh = &rq->rq_queues[bit + (i << RQB_L2BPW)];
TAILQ_FOREACH(td, rqh, td_runq) {
if (first && THREAD_CAN_MIGRATE(td) &&
THREAD_CAN_SCHED(td, cpu))
return (td);
first = td;
if (first) {
if (THREAD_CAN_MIGRATE(td) &&
THREAD_CAN_SCHED(td, cpu))
return (td);
} else
first = td;
}
}
}