FreeBSD/sys/kern/sched_ule.c
/*
 * Pick the highest priority task we have and return it.
 */
Pick the highest priority task we have and return it.
Pick the highest priority task we have and return it .
static struct thread *
tdq_choose(struct tdq *tdq)
{
	struct thread *td;
	TDQ_LOCK_ASSERT(tdq, MA_OWNED);
	td = runq_choose(&tdq->tdq_realtime);
	if (td != NULL)
		return (td);
	td = runq_choose_from(&tdq->tdq_timeshare, tdq->tdq_ridx);
	if (td != NULL) {
		KASSERT(td->td_priority >= PRI_MIN_BATCH,
		    ("tdq_choose: Invalid priority on timeshare queue %d",
		    td->td_priority));
		return (td);
	}
	td = runq_choose(&tdq->tdq_idle);
	if (td != NULL) {
		KASSERT(td->td_priority >= PRI_MIN_IDLE,
		    ("tdq_choose: Invalid priority on idle queue %d",
		    td->td_priority));
		return (td);
	}
	return (NULL);
}
static struct thread * tdq_choose ( struct tdq * tdq ) { struct thread * td ; TDQ_LOCK_ASSERT ( tdq , MA_OWNED ) ; td = runq_choose ( & tdq -> tdq_realtime ) ; if ( td != NULL ) return ( td ) ; td = runq_choose_from ( & tdq -> tdq_timeshare , tdq -> tdq_ridx ) ; if ( td != NULL ) { KASSERT ( td -> td_priority >= PRI_MIN_BATCH , ( " " , td -> td_priority ) ) ; return ( td ) ; } td = runq_choose ( & tdq -> tdq_idle ) ; if ( td != NULL ) { KASSERT ( td -> td_priority >= PRI_MIN_IDLE , ( " " , td -> td_priority ) ) ; return ( td ) ; } return ( NULL ) ; }
Pick the highest priority task we have and return it.
Pick the highest priority task we have and return it .