Always set a process' state to normal when it is fully constructed in

fork1() rather than only doing it for the RFSTOPPED case and then having
to fix it up in other places later on.
This commit is contained in:
John Baldwin 2004-02-05 21:01:37 +00:00
parent b4323d7729
commit 4c3558aa82
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=125496
2 changed files with 9 additions and 6 deletions

View File

@ -680,18 +680,22 @@ fork1(td, flags, pages, procp)
*/
EVENTHANDLER_INVOKE(process_fork, p1, p2, flags);
/*
* Set the child start time and mark the process as being complete.
*/
microuptime(&p2->p_stats->p_start);
mtx_lock_spin(&sched_lock);
p2->p_state = PRS_NORMAL;
/*
* If RFSTOPPED not requested, make child runnable and add to
* run queue.
*/
microuptime(&p2->p_stats->p_start);
if ((flags & RFSTOPPED) == 0) {
mtx_lock_spin(&sched_lock);
p2->p_state = PRS_NORMAL;
TD_SET_CAN_RUN(td2);
setrunqueue(td2);
mtx_unlock_spin(&sched_lock);
}
mtx_unlock_spin(&sched_lock);
/*
* Now can be swapped.
@ -776,7 +780,7 @@ fork_exit(callout, arg, frame)
td = curthread;
p = td->td_proc;
td->td_oncpu = PCPU_GET(cpuid);
p->p_state = PRS_NORMAL;
KASSERT(p->p_state == PRS_NORMAL, ("executing process is still new"));
/*
* Finish setting up thread glue so that it begins execution in a

View File

@ -57,7 +57,6 @@ idle_setup(void *dummy)
PROC_LOCK(p);
p->p_flag |= P_NOLOAD;
mtx_lock_spin(&sched_lock);
p->p_state = PRS_NORMAL;
td = FIRST_THREAD_IN_PROC(p);
td->td_state = TDS_CAN_RUN;
td->td_flags |= TDF_IDLETD;