FreeBSD/sys/kern/sched_ule.c
/*
 * This is called from fork_exit().  Just acquire the correct locks and
 * let fork do the rest of the work.
 */
This is called from fork_exit().  Just acquire the correct locks and
let fork do the rest of the work.
This is called from fork_exit () . Just acquire the correct locks and let fork do the rest of the work .
void
sched_fork_exit(struct thread *td)
{
	struct tdq *tdq;
	int cpuid;
	cpuid = PCPU_GET(cpuid);
	tdq = TDQ_CPU(cpuid);
	if (TD_IS_IDLETHREAD(td))
		td->td_lock = TDQ_LOCKPTR(tdq);
	MPASS(td->td_lock == TDQ_LOCKPTR(tdq));
	td->td_oncpu = cpuid;
	TDQ_LOCK_ASSERT(tdq, MA_OWNED | MA_NOTRECURSED);
	lock_profile_obtain_lock_success(
	    &TDQ_LOCKPTR(tdq)->lock_object, 0, 0, __FILE__, __LINE__);
}
void sched_fork_exit ( struct thread * td ) { struct tdq * tdq ; int cpuid ; cpuid = PCPU_GET ( cpuid ) ; tdq = TDQ_CPU ( cpuid ) ; if ( TD_IS_IDLETHREAD ( td ) ) td -> td_lock = TDQ_LOCKPTR ( tdq ) ; MPASS ( td -> td_lock == TDQ_LOCKPTR ( tdq ) ) ; td -> td_oncpu = cpuid ; TDQ_LOCK_ASSERT ( tdq , MA_OWNED | MA_NOTRECURSED ) ; lock_profile_obtain_lock_success ( & TDQ_LOCKPTR ( tdq ) -> lock_object , 0 , 0 , __FILE__ , __LINE__ ) ; }
This is called from fork_exit().
This is called from fork_exit () .
/*
	 * Finish setting up thread glue so that it begins execution in a
	 * non-nested critical section with the scheduler lock held.
	 */