* Attempt to steal a thread in priority order from a thread queue. */
| 1181 | * Attempt to steal a thread in priority order from a thread queue. |
| 1182 | */ |
| 1183 | static struct thread * |
| 1184 | tdq_steal(struct tdq *tdq, int cpu) |
| 1185 | { |
| 1186 | struct thread *td; |
| 1187 | |
| 1188 | TDQ_LOCK_ASSERT(tdq, MA_OWNED); |
| 1189 | if ((td = runq_steal(&tdq->tdq_realtime, cpu)) != NULL) |
| 1190 | return (td); |
| 1191 | if ((td = runq_steal_from(&tdq->tdq_timeshare, |
| 1192 | cpu, tdq->tdq_ridx)) != NULL) |
| 1193 | return (td); |
| 1194 | return (runq_steal(&tdq->tdq_idle, cpu)); |
| 1195 | } |
| 1196 | |
| 1197 | /* |
| 1198 | * Sets the thread lock and ts_cpu to match the requested cpu. Unlocks the |
no test coverage detected