Index: sys/kern/kern_event.c =================================================================== --- sys/kern/kern_event.c (revision 238425) +++ sys/kern/kern_event.c (working copy) @@ -513,33 +513,35 @@ knote_fork(struct knlist *list, int pid) list->kl_unlock(list->kl_lockarg); } -static int -timertoticks(intptr_t data) +static struct bintime +timer2bintime(intptr_t data) { - struct timeval tv; - int tticks; + struct bintime bt, pbt; - tv.tv_sec = data / 1000; - tv.tv_usec = (data % 1000) * 1000; - tticks = tvtohz(&tv); - - return tticks; + getbinuptime(&pbt); + bt.sec = data / 1000; + bt.frac = (data % 1000) * (uint64_t)1844674407309000LL; + bintime_add(&bt, &pbt); + return bt; } /* XXX - move to kern_timeout.c? */ static void filt_timerexpire(void *knx) { - struct knote *kn = knx; + struct bintime bt; struct callout *calloutp; - + struct knote *kn; + + kn = knx; kn->kn_data++; KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ if ((kn->kn_flags & EV_ONESHOT) != EV_ONESHOT) { + bt = timer2bintime(kn->kn_sdata); calloutp = (struct callout *)kn->kn_hook; - callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata), - filt_timerexpire, kn); + callout_reset_bt_on(calloutp, &bt, filt_timerexpire, kn, + PCPU_GET(cpuid), C_P1MS); } } @@ -550,6 +552,7 @@ filt_timerexpire(void *knx) static int filt_timerattach(struct knote *kn) { + struct bintime bt; struct callout *calloutp; atomic_add_int(&kq_ncallouts, 1); @@ -564,8 +567,9 @@ filt_timerattach(struct knote *kn) calloutp = malloc(sizeof(*calloutp), M_KQUEUE, M_WAITOK); callout_init(calloutp, CALLOUT_MPSAFE); kn->kn_hook = calloutp; - callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata), - filt_timerexpire, kn); + bt = timer2bintime(kn->kn_sdata); + callout_reset_bt_on(calloutp, &bt, filt_timerexpire, kn, + PCPU_GET(cpuid), C_P1MS); return (0); }