diff options
author | jeff <jeff@FreeBSD.org> | 2003-12-11 04:00:49 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-12-11 04:00:49 +0000 |
commit | da98a74234d770fbe15d09a3a0f51778cb9d9974 (patch) | |
tree | cc5996250fc59a52bbb3387dc0dea3e27a2da746 | |
parent | 7c857e9275104c0bd522055920e5dd4f19928e1f (diff) | |
download | FreeBSD-src-da98a74234d770fbe15d09a3a0f51778cb9d9974.zip FreeBSD-src-da98a74234d770fbe15d09a3a0f51778cb9d9974.tar.gz |
- 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.
-rw-r--r-- | sys/kern/sched_ule.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 1c47384..f7a9636 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -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) |