Index: sys/sys/sleepqueue.h =================================================================== --- sys/sys/sleepqueue.h (revision 236814) +++ sys/sys/sleepqueue.h (working copy) @@ -108,8 +108,11 @@ void sleepq_release(void *wchan); void sleepq_remove(struct thread *td, void *wchan); int sleepq_signal(void *wchan, int flags, int pri, int queue); -void sleepq_set_timeout_bt(void *wchan, struct bintime bt); -void sleepq_set_timeout(void *wchan, int timo); +void _sleepq_set_timeout(void *wchan, struct bintime *bt, int *timo); +#define sleepq_set_timeout(wchan, timo) \ + _sleepq_set_timeout((wchan), (NULL), (&timo)) +#define sleepq_set_timeout_bt(wchan, bt) \ + _sleepq_set_timeout((wchan), (&bt), (NULL)) u_int sleepq_sleepcnt(void *wchan, int queue); int sleepq_timedwait(void *wchan, int pri); int sleepq_timedwait_sig(void *wchan, int pri); Index: sys/kern/subr_sleepqueue.c =================================================================== --- sys/kern/subr_sleepqueue.c (revision 236815) +++ sys/kern/subr_sleepqueue.c (working copy) @@ -362,36 +362,28 @@ * sleep queue after timo ticks if the thread has not already been awakened. */ void -sleepq_set_timeout_bt(void *wchan, struct bintime bt) +_sleepq_set_timeout(void *wchan, struct bintime *bt, int *timo) { struct sleepqueue_chain *sc; struct thread *td; + KASSERT(bt == NULL || timo == NULL, + ("one between bt and timo should be NULL")); td = curthread; sc = SC_LOOKUP(wchan); mtx_assert(&sc->sc_lock, MA_OWNED); MPASS(TD_ON_SLEEPQ(td)); MPASS(td->td_sleepqueue == NULL); MPASS(wchan != NULL); - callout_reset_bt_on(&td->td_slpcallout, bt, sleepq_timeout, td, PCPU_GET(cpuid), 0); + if (bt == NULL) + callout_reset_curcpu(&td->td_slpcallout, *timo, + sleepq_timeout, td); + else + callout_reset_bt_on(&td->td_slpcallout, *bt, + sleepq_timeout, td, PCPU_GET(cpuid), 0); } -void -sleepq_set_timeout(void *wchan, int timo) -{ - struct sleepqueue_chain *sc; - struct thread *td; - - td = curthread; - sc = SC_LOOKUP(wchan); - mtx_assert(&sc->sc_lock, MA_OWNED); - MPASS(TD_ON_SLEEPQ(td)); - MPASS(td->td_sleepqueue == NULL); - MPASS(wchan != NULL); - callout_reset_curcpu(&td->td_slpcallout, timo, sleepq_timeout, td); -} - /* * Return the number of actual sleepers for the specified queue. */