* Schedule a thread to resume execution and record how long it voluntarily * slept. We also update the pctcpu, interactivity, and priority. * * Requires the thread lock on entry, drops on exit. */
| 2208 | * Requires the thread lock on entry, drops on exit. |
| 2209 | */ |
| 2210 | void |
| 2211 | sched_wakeup(struct thread *td, int srqflags) |
| 2212 | { |
| 2213 | struct td_sched *ts; |
| 2214 | int slptick; |
| 2215 | |
| 2216 | THREAD_LOCK_ASSERT(td, MA_OWNED); |
| 2217 | ts = td_get_sched(td); |
| 2218 | td->td_flags &= ~TDF_CANSWAP; |
| 2219 | |
| 2220 | /* |
| 2221 | * If we slept for more than a tick update our interactivity and |
| 2222 | * priority. |
| 2223 | */ |
| 2224 | slptick = td->td_slptick; |
| 2225 | td->td_slptick = 0; |
| 2226 | if (slptick && slptick != ticks) { |
| 2227 | ts->ts_slptime += (ticks - slptick) << SCHED_TICK_SHIFT; |
| 2228 | sched_interact_update(td); |
| 2229 | sched_pctcpu_update(ts, 0); |
| 2230 | } |
| 2231 | /* |
| 2232 | * Reset the slice value since we slept and advanced the round-robin. |
| 2233 | */ |
| 2234 | ts->ts_slice = 0; |
| 2235 | sched_add(td, SRQ_BORING | srqflags); |
| 2236 | } |
| 2237 | |
| 2238 | /* |
| 2239 | * Penalize the parent for creating a new child and initialize the child's |
no test coverage detected