diff options
author | julian <julian@FreeBSD.org> | 2004-09-01 02:11:28 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2004-09-01 02:11:28 +0000 |
commit | e9d9514975605045da565470477ceafa13f6174b (patch) | |
tree | 16691683be7649ae0915de2c1fa1995b931091a3 /sys/kern/sched_4bsd.c | |
parent | eeddbfb0fa1e4bef7bff6ff83926b674f7d9e29c (diff) | |
download | FreeBSD-src-e9d9514975605045da565470477ceafa13f6174b.zip FreeBSD-src-e9d9514975605045da565470477ceafa13f6174b.tar.gz |
Give setrunqueue() and sched_add() more of a clue as to
where they are coming from and what is expected from them.
MFC after: 2 days
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r-- | sys/kern/sched_4bsd.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 6c6f0c3..ae8046a 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -664,7 +664,7 @@ sched_switch(struct thread *td, struct thread *newtd) TD_SET_CAN_RUN(td); else if (TD_IS_RUNNING(td)) { /* Put us back on the run queue (kse and all). */ - setrunqueue(td); + setrunqueue(td, SRQ_OURSELF|SRQ_YIELDING); } else if (p->p_flag & P_SA) { /* * We will not be on the run queue. So we must be @@ -691,11 +691,11 @@ sched_wakeup(struct thread *td) if (kg->kg_slptime > 1) updatepri(kg); kg->kg_slptime = 0; - setrunqueue(td); + setrunqueue(td, SRQ_BORING); } void -sched_add(struct thread *td) +sched_add(struct thread *td, int flags) { struct kse *ke; @@ -717,8 +717,13 @@ sched_add(struct thread *td) */ if (KSE_CAN_MIGRATE(ke) || ke->ke_runq == &runq_pcpu[PCPU_GET(cpuid)]) #endif - if (maybe_preempt(td)) - return; + /* + * Don't try preempt if we are already switching. + * all hell might break loose. + */ + if ((flags & SRQ_YIELDING) == 0) + if (maybe_preempt(td)) + return; #ifdef SMP if (KSE_CAN_MIGRATE(ke)) { |