diff options
author | davidxu <davidxu@FreeBSD.org> | 2002-10-25 12:50:31 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2002-10-25 12:50:31 +0000 |
commit | de4094aa3128816915ac063aac334ec900f5bf3e (patch) | |
tree | 5bcd375014a35fd4f476425730a24ba93163dc12 /sys/kern/kern_thread.c | |
parent | 1bb07283e095e4a16ecc8b9896aefbdaba3a72ab (diff) | |
download | FreeBSD-src-de4094aa3128816915ac063aac334ec900f5bf3e.zip FreeBSD-src-de4094aa3128816915ac063aac334ec900f5bf3e.tar.gz |
let thread_schedule_upcall() handle idle kse.
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r-- | sys/kern/kern_thread.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 5722cc2..2b4ad4a 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -369,8 +369,6 @@ kse_wakeup(struct thread *td, struct kse_wakeup_args *uap) return ESRCH; } found: - TAILQ_REMOVE(&kg->kg_iq, ke, ke_kgrlist); - kg->kg_idle_kses--; thread_schedule_upcall(td, ke); mtx_unlock_spin(&sched_lock); td->td_retval[0] = 0; @@ -1039,6 +1037,7 @@ struct thread * thread_schedule_upcall(struct thread *td, struct kse *ke) { struct thread *td2; + struct ksegrp *kg; int newkse; mtx_assert(&sched_lock, MA_OWNED); @@ -1059,6 +1058,12 @@ thread_schedule_upcall(struct thread *td, struct kse *ke) } KASSERT((ke->ke_bound == NULL), ("kse already bound")); + if (ke->ke_state == KES_IDLE) { + kg = ke->ke_ksegrp; + TAILQ_REMOVE(&kg->kg_iq, ke, ke_kgrlist); + kg->kg_idle_kses--; + ke->ke_state = KES_UNQUEUED; + } if ((td2 = td->td_standin) != NULL) { td->td_standin = NULL; } else { @@ -1115,6 +1120,7 @@ thread_schedule_upcall(struct thread *td, struct kse *ke) } else { ke->ke_bound = NULL; ke->ke_thread = td2; + ke->ke_state = KES_THREAD; setrunqueue(td2); } return (td2); /* bogus.. should be a void function */ |