FreeBSD/sys/kern/sched_ule.c
/*
 * Choose the highest priority thread to run.  The thread is removed from
 * the run-queue while running however the load remains.  For SMP we set
 * the tdq in the global idle bitmask if it idles here.
 */
Choose the highest priority thread to run.  The thread is removed from
the run-queue while running however the load remains.  For SMP we set
the tdq in the global idle bitmask if it idles here.
Choose the highest priority thread to run . The thread is removed from the run - queue while running however the load remains . For SMP we set the tdq in the global idle bitmask if it idles here .
struct thread *
sched_choose(void)
{
	struct thread *td;
	struct tdq *tdq;
	tdq = TDQ_SELF();
	TDQ_LOCK_ASSERT(tdq, MA_OWNED);
	td = tdq_choose(tdq);
	if (td) {
		tdq_runq_rem(tdq, td);
		tdq->tdq_lowpri = td->td_priority;
		return (td);
	}
	tdq->tdq_lowpri = PRI_MAX_IDLE;
	return (PCPU_GET(idlethread));
}
struct thread * sched_choose ( void ) { struct thread * td ; struct tdq * tdq ; tdq = TDQ_SELF ( ) ; TDQ_LOCK_ASSERT ( tdq , MA_OWNED ) ; td = tdq_choose ( tdq ) ; if ( td ) { tdq_runq_rem ( tdq , td ) ; tdq -> tdq_lowpri = td -> td_priority ; return ( td ) ; } tdq -> tdq_lowpri = PRI_MAX_IDLE ; return ( PCPU_GET ( idlethread ) ) ; }
Choose the highest priority thread to run.
Choose the highest priority thread to run .