Clear ke_runq before calling maybe_preempt, this avoids a

KASSERT(ke->ke_runq == NULL) panic when the sched_add is recursively
called by maybe_preempt.

Reported by: Wojciech A. Koszek < dunstan at freebsd dot czest dot pl >
This commit is contained in:
David Xu 2006-06-14 03:46:03 +00:00
parent 6ad26d8376
commit c2c1ab1858

View File

@ -2150,8 +2150,10 @@ sched_add(struct thread *td, int flags)
if (ke->ke_runq == my_ksq->ksq_curr &&
td->td_priority < curthread->td_priority) {
curthread->td_flags |= TDF_NEEDRESCHED;
ke->ke_runq = NULL;
if (preemptive && maybe_preempt(td))
return;
ke->ke_runq = my_ksq->ksq_curr;
if (curthread->td_ksegrp->kg_pri_class == PRI_IDLE)
td->td_owepreempt = 1;
}