* Add a thread to a thread queue. Select the appropriate runq and add the * thread to it. This is the internal function called when the tdq is * predetermined. */
| 2545 | * predetermined. |
| 2546 | */ |
| 2547 | void |
| 2548 | tdq_add(struct tdq *tdq, struct thread *td, int flags) |
| 2549 | { |
| 2550 | |
| 2551 | TDQ_LOCK_ASSERT(tdq, MA_OWNED); |
| 2552 | THREAD_LOCK_BLOCKED_ASSERT(td, MA_OWNED); |
| 2553 | KASSERT((td->td_inhibitors == 0), |
| 2554 | ("sched_add: trying to run inhibited thread")); |
| 2555 | KASSERT((TD_CAN_RUN(td) || TD_IS_RUNNING(td)), |
| 2556 | ("sched_add: bad thread state")); |
| 2557 | KASSERT(td->td_flags & TDF_INMEM, |
| 2558 | ("sched_add: thread swapped out")); |
| 2559 | |
| 2560 | if (td->td_priority < tdq->tdq_lowpri) |
| 2561 | tdq->tdq_lowpri = td->td_priority; |
| 2562 | tdq_runq_add(tdq, td, flags); |
| 2563 | tdq_load_add(tdq, td); |
| 2564 | } |
| 2565 | |
| 2566 | /* |
| 2567 | * Select the target thread queue and add a thread to it. Request |
no test coverage detected