diff options
author | julian <julian@FreeBSD.org> | 2002-08-01 18:45:10 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-08-01 18:45:10 +0000 |
commit | b3aca85def667b6b08a1073688d0b21bcc075ffb (patch) | |
tree | 8a197b12a5345ddab4947db75c41005118cfc2c2 /sys/kern/kern_intr.c | |
parent | c9a153d8bb4613add10b9e75b74196428e7aedd6 (diff) | |
download | FreeBSD-src-b3aca85def667b6b08a1073688d0b21bcc075ffb.zip FreeBSD-src-b3aca85def667b6b08a1073688d0b21bcc075ffb.tar.gz |
Slight cleanup of some comments/whitespace.
Make idle process state more consistant.
Add an assert on thread state.
Clean up idleproc/mi_switch() interaction.
Use a local instead of referencing curthread 7 times in a row
(I've been told curthread can be expensive on some architectures)
Remove some commented out code.
Add a little commented out code (completion coming soon)
Reviewed by: jhb@freebsd.org
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 fb9c092..db0a3f5 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; |