- In sched_switch(), if a thread has been assigned, don't touch the runqueues

or load.  These things have already been taken care of in sched_bind()
   which should be the only place that we're switching in an assigned thread.
This commit is contained in:
Jeff Roberson 2003-12-11 04:00:49 +00:00
parent 80f86c9f88
commit b11fdad0fc

View File

@ -1062,21 +1062,27 @@ sched_switch(struct thread *td)
td->td_oncpu = NOCPU;
td->td_flags &= ~TDF_NEEDRESCHED;
if (TD_IS_RUNNING(td)) {
if (td->td_proc->p_flag & P_SA) {
kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);
setrunqueue(td);
} else
kseq_runq_add(KSEQ_SELF(), ke);
} else {
if (ke->ke_runq)
kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);
/*
* We will not be on the run queue. So we must be
* sleeping or similar.
*/
if (td->td_proc->p_flag & P_SA)
kse_reassign(ke);
/*
* If the KSE has been assigned it may be in the process of switching
* to the new cpu. This is the case in sched_bind().
*/
if ((ke->ke_flags & KEF_ASSIGNED) == 0) {
if (TD_IS_RUNNING(td)) {
if (td->td_proc->p_flag & P_SA) {
kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);
setrunqueue(td);
} else
kseq_runq_add(KSEQ_SELF(), ke);
} else {
if (ke->ke_runq)
kseq_load_rem(KSEQ_CPU(ke->ke_cpu), ke);
/*
* We will not be on the run queue. So we must be
* sleeping or similar.
*/
if (td->td_proc->p_flag & P_SA)
kse_reassign(ke);
}
}
newtd = choosethread();
if (td != newtd)