diff options
| author | Julian Elischer <julian@FreeBSD.org> | 2002-08-01 18:45:10 +0000 |
|---|---|---|
| committer | Julian Elischer <julian@FreeBSD.org> | 2002-08-01 18:45:10 +0000 |
| commit | 04774f2357e4c0f879cc50b2e17ba445108a0a7a (patch) | |
| tree | 8a197b12a5345ddab4947db75c41005118cfc2c2 /sys/kern/kern_intr.c | |
| parent | ee0812f32049d2a8cc09699598db1f4c7276f4d4 (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_intr.c')
| -rw-r--r-- | sys/kern/kern_intr.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index fb9c092d4311..db0a3f54b95f 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -351,6 +351,7 @@ ithread_schedule(struct ithd *ithread, int do_switch) { struct int_entropy entropy; struct thread *td; + struct thread *ctd; struct proc *p; /* @@ -359,13 +360,14 @@ ithread_schedule(struct ithd *ithread, int do_switch) if ((ithread == NULL) || TAILQ_EMPTY(&ithread->it_handlers)) return (EINVAL); + ctd = curthread; /* * If any of the handlers for this ithread claim to be good * sources of entropy, then gather some. */ if (harvest.interrupt && ithread->it_flags & IT_ENTROPY) { entropy.vector = ithread->it_vector; - entropy.proc = curthread->td_proc;; + entropy.proc = ctd->td_proc;; random_harvest(&entropy, sizeof(entropy), 2, 0, RANDOM_INTERRUPT); } @@ -390,13 +392,12 @@ ithread_schedule(struct ithd *ithread, int do_switch) CTR2(KTR_INTR, "%s: setrunqueue %d", __func__, p->p_pid); setrunqueue(td); if (do_switch && - (curthread->td_critnest == 1)/* && - (curthread->td_state == TDS_RUNNING) XXXKSE*/) { -#if 0 /* not needed in KSE */ - if (curthread != PCPU_GET(idlethread)) - setrunqueue(curthread); -#endif - curthread->td_proc->p_stats->p_ru.ru_nivcsw++; + (ctd->td_critnest == 1) ) { + KASSERT((ctd->td_state == TDS_RUNNING), + ("ithread_schedule: Bad state for curthread.")); + ctd->td_proc->p_stats->p_ru.ru_nivcsw++; + if (ctd->td_kse->ke_flags & KEF_IDLEKSE) + ctd->td_state = TDS_UNQUEUED; mi_switch(); } else { curthread->td_kse->ke_flags |= KEF_NEEDRESCHED; |
