- ULE and 4BSD share only one line of code from sched_newthread() so implement

the required pieces in sched_fork_thread().  The td_sched pointer is already
   setup by thread_init anyway.
This commit is contained in:
Jeff Roberson 2008-03-20 03:06:33 +00:00
parent 0ac213ef80
commit 8b16c208e6
2 changed files with 10 additions and 7 deletions

View File

@ -733,10 +733,14 @@ sched_fork(struct thread *td, struct thread *childtd)
void
sched_fork_thread(struct thread *td, struct thread *childtd)
{
struct td_sched *ts;
childtd->td_estcpu = td->td_estcpu;
childtd->td_lock = &sched_lock;
childtd->td_cpuset = cpuset_ref(td->td_cpuset);
sched_newthread(childtd);
ts = childtd->td_sched;
bzero(ts, sizeof(*ts));
ts->ts_thread = childtd;
}
void

View File

@ -488,7 +488,6 @@ tdq_load_rem(struct tdq *tdq, struct td_sched *ts)
("tdq_load_rem: Removing with 0 load on queue %d", TDQ_ID(tdq)));
tdq->tdq_load--;
CTR1(KTR_SCHED, "load: %d", tdq->tdq_load);
ts->ts_runq = NULL;
}
/*
@ -1905,17 +1904,17 @@ sched_fork_thread(struct thread *td, struct thread *child)
struct td_sched *ts;
struct td_sched *ts2;
THREAD_LOCK_ASSERT(td, MA_OWNED);
/*
* Initialize child.
*/
THREAD_LOCK_ASSERT(td, MA_OWNED);
sched_newthread(child);
child->td_lock = TDQ_LOCKPTR(TDQ_SELF());
child->td_cpuset = cpuset_ref(td->td_cpuset);
ts = td->td_sched;
ts2 = child->td_sched;
child->td_lock = TDQ_LOCKPTR(TDQ_SELF());
child->td_cpuset = cpuset_ref(td->td_cpuset);
ts2->ts_thread = child;
ts2->ts_cpu = ts->ts_cpu;
ts2->ts_runq = NULL;
ts2->ts_flags = 0;
/*
* Grab our parents cpu estimation information and priority.
*/