MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sched_choose

Function sched_choose

freebsd/kern/sched_ule.c:2499–2515  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

2497 * the tdq in the global idle bitmask if it idles here.
2498 */
2499struct thread *
2500sched_choose(void)
2501{
2502 struct thread *td;
2503 struct tdq *tdq;
2504
2505 tdq = TDQ_SELF();
2506 TDQ_LOCK_ASSERT(tdq, MA_OWNED);
2507 td = tdq_choose(tdq);
2508 if (td) {
2509 tdq_runq_rem(tdq, td);
2510 tdq->tdq_lowpri = td->td_priority;
2511 return (td);
2512 }
2513 tdq->tdq_lowpri = PRI_MAX_IDLE;
2514 return (PCPU_GET(idlethread));
2515}
2516
2517/*
2518 * Set owepreempt if necessary. Preemption never happens directly in ULE,

Callers 2

choosethread_panicFunction · 0.70
choosethreadFunction · 0.70

Calls 2

tdq_chooseFunction · 0.85
tdq_runq_remFunction · 0.85

Tested by

no test coverage detected