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

Function tdq_choose

freebsd/kern/sched_ule.c:1376–1401  ·  view source on GitHub ↗

* Pick the highest priority task we have and return it. */

Source from the content-addressed store, hash-verified

1374 * Pick the highest priority task we have and return it.
1375 */
1376static struct thread *
1377tdq_choose(struct tdq *tdq)
1378{
1379 struct thread *td;
1380
1381 TDQ_LOCK_ASSERT(tdq, MA_OWNED);
1382 td = runq_choose(&tdq->tdq_realtime);
1383 if (td != NULL)
1384 return (td);
1385 td = runq_choose_from(&tdq->tdq_timeshare, tdq->tdq_ridx);
1386 if (td != NULL) {
1387 KASSERT(td->td_priority >= PRI_MIN_BATCH,
1388 ("tdq_choose: Invalid priority on timeshare queue %d",
1389 td->td_priority));
1390 return (td);
1391 }
1392 td = runq_choose(&tdq->tdq_idle);
1393 if (td != NULL) {
1394 KASSERT(td->td_priority >= PRI_MIN_IDLE,
1395 ("tdq_choose: Invalid priority on idle queue %d",
1396 td->td_priority));
1397 return (td);
1398 }
1399
1400 return (NULL);
1401}
1402
1403/*
1404 * Initialize a thread queue.

Callers 2

tdq_setlowpriFunction · 0.85
sched_chooseFunction · 0.85

Calls 2

runq_chooseFunction · 0.85
runq_choose_fromFunction · 0.85

Tested by

no test coverage detected