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

Function sched_wakeup

freebsd/kern/sched_ule.c:2210–2236  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2208 * Requires the thread lock on entry, drops on exit.
2209 */
2210void
2211sched_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

Callers 1

setrunnableFunction · 0.70

Calls 4

td_get_schedFunction · 0.85
sched_interact_updateFunction · 0.85
sched_pctcpu_updateFunction · 0.85
sched_addFunction · 0.70

Tested by

no test coverage detected