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:
parent
b4323d7729
commit
4c3558aa82
@ -680,18 +680,22 @@ again:
|
|||||||
*/
|
*/
|
||||||
EVENTHANDLER_INVOKE(process_fork, p1, p2, flags);
|
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
|
* If RFSTOPPED not requested, make child runnable and add to
|
||||||
* run queue.
|
* run queue.
|
||||||
*/
|
*/
|
||||||
microuptime(&p2->p_stats->p_start);
|
|
||||||
if ((flags & RFSTOPPED) == 0) {
|
if ((flags & RFSTOPPED) == 0) {
|
||||||
mtx_lock_spin(&sched_lock);
|
|
||||||
p2->p_state = PRS_NORMAL;
|
|
||||||
TD_SET_CAN_RUN(td2);
|
TD_SET_CAN_RUN(td2);
|
||||||
setrunqueue(td2);
|
setrunqueue(td2);
|
||||||
mtx_unlock_spin(&sched_lock);
|
|
||||||
}
|
}
|
||||||
|
mtx_unlock_spin(&sched_lock);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now can be swapped.
|
* Now can be swapped.
|
||||||
@ -776,7 +780,7 @@ fork_exit(callout, arg, frame)
|
|||||||
td = curthread;
|
td = curthread;
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
td->td_oncpu = PCPU_GET(cpuid);
|
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
|
* Finish setting up thread glue so that it begins execution in a
|
||||||
|
@ -57,7 +57,6 @@ idle_setup(void *dummy)
|
|||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
p->p_flag |= P_NOLOAD;
|
p->p_flag |= P_NOLOAD;
|
||||||
mtx_lock_spin(&sched_lock);
|
mtx_lock_spin(&sched_lock);
|
||||||
p->p_state = PRS_NORMAL;
|
|
||||||
td = FIRST_THREAD_IN_PROC(p);
|
td = FIRST_THREAD_IN_PROC(p);
|
||||||
td->td_state = TDS_CAN_RUN;
|
td->td_state = TDS_CAN_RUN;
|
||||||
td->td_flags |= TDF_IDLETD;
|
td->td_flags |= TDF_IDLETD;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user