Index: sched_ule.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sched_ule.c,v retrieving revision 1.229 diff -u -r1.229 sched_ule.c --- sched_ule.c 10 Mar 2008 09:50:29 -0000 1.229 +++ sched_ule.c 10 Mar 2008 11:01:52 -0000 @@ -2068,6 +2074,7 @@ void sched_userret(struct thread *td) { + struct tdq *tdq; /* * XXX we cheat slightly on the locking here to avoid locking in * the usual case. Setting td_priority here is essentially an @@ -2080,10 +2087,12 @@ KASSERT((td->td_flags & TDF_BORROWING) == 0, ("thread with borrowed priority returning to userland")); if (td->td_priority != td->td_user_pri) { + tdq = TDQ_SELF(); thread_lock(td); td->td_priority = td->td_user_pri; td->td_base_pri = td->td_user_pri; - tdq_setlowpri(TDQ_SELF(), td); + tdq_runq_pick(tdq, td->td_sched); + tdq_setlowpri(tdq, td); thread_unlock(td); } }