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

Function sched_fork_exit

freebsd/kern/sched_ule.c:2934–2955  ·  view source on GitHub ↗

* This is called from fork_exit(). Just acquire the correct locks and * let fork do the rest of the work. */

Source from the content-addressed store, hash-verified

2932 * let fork do the rest of the work.
2933 */
2934void
2935sched_fork_exit(struct thread *td)
2936{
2937 struct tdq *tdq;
2938 int cpuid;
2939
2940 /*
2941 * Finish setting up thread glue so that it begins execution in a
2942 * non-nested critical section with the scheduler lock held.
2943 */
2944 KASSERT(curthread->td_md.md_spinlock_count == 1,
2945 ("invalid count %d", curthread->td_md.md_spinlock_count));
2946 cpuid = PCPU_GET(cpuid);
2947 tdq = TDQ_SELF();
2948 TDQ_LOCK(tdq);
2949 spinlock_exit();
2950 MPASS(td->td_lock == TDQ_LOCKPTR(tdq));
2951 td->td_oncpu = cpuid;
2952 KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "running",
2953 "prio:%d", td->td_priority);
2954 SDT_PROBE0(sched, , , on__cpu);
2955}
2956
2957/*
2958 * Create on first use to catch odd startup conditons.

Callers 1

fork_exitFunction · 0.70

Calls 2

sched_tdnameFunction · 0.70
spinlock_exitFunction · 0.50

Tested by

no test coverage detected