From 201b0ea8fdf5a8a4275ad528b94f263edc01c2bb Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 14 Dec 2001 23:37:35 +0000 Subject: [PATCH] Fix some nits in fork_exit() so it more properly duplicates the backend of mi_switch: - Set the oncpu value for the current thread. - Always set switchticks, not just in the SMP case. - Add a KTR entry for fork_exit that is the same as the "new proc" entry in mi_switch(). - Release sched_lock a bit later like we do with mi_switch(). --- sys/kern/kern_fork.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 28f0970fe2d..bb52a34b8ef 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -760,6 +760,7 @@ fork_exit(callout, arg, frame) struct thread *td = curthread; struct proc *p = td->td_proc; + td->td_kse->ke_oncpu = PCPU_GET(cpuid); /* * Setup the sched_lock state so that we can release it. */ @@ -769,13 +770,12 @@ fork_exit(callout, arg, frame) * XXX: We really shouldn't have to do this. */ mtx_intr_enable(&sched_lock); - mtx_unlock_spin(&sched_lock); - -#ifdef SMP + CTR3(KTR_PROC, "fork_exit: new proc %p (pid %d, %s)", p, p->p_pid, + p->p_comm); if (PCPU_GET(switchtime.tv_sec) == 0) microuptime(PCPU_PTR(switchtime)); PCPU_SET(switchticks, ticks); -#endif + mtx_unlock_spin(&sched_lock); /* * cpu_set_fork_handler intercepts this function call to