From e7fa55af89be8c37ee53245d7a18070ae56326b2 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Wed, 4 Sep 2002 10:15:19 +0000 Subject: [PATCH] Give up on calling tc_ticktock() from a timeout, we have timeout functions which run for several milliseconds at a time and getting in queue behind one or more of those makes us miss our rewind. Instead call it from hardclock() like we used to do, but retain the prescaler so we still cope with high HZ values. --- sys/kern/kern_clock.c | 2 ++ sys/kern/kern_tc.c | 10 ++++++---- sys/sys/timetc.h | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 2e7ca8b7853..e50b73182a9 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -208,6 +209,7 @@ hardclock(frame) hardclock_process(curthread, CLKF_USERMODE(frame)); mtx_unlock_spin_flags(&sched_lock, MTX_QUIET); + tc_ticktock(); /* * If no separate statistics clock is available, run it from here. * diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index e2607bf352a..d3d437d441d 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -647,12 +647,15 @@ pps_event(struct pps_state *pps, int event) static int tc_tick; SYSCTL_INT(_kern_timecounter, OID_AUTO, tick, CTLFLAG_RD, &tick, 0, ""); -static void -tc_ticktock(void *dummy) +void +tc_ticktock(void) { + static int count; + if (++count < tc_tick) + return; + count = 0; tc_windup(); - timeout(tc_ticktock, NULL, tc_tick); } static void @@ -678,7 +681,6 @@ inittimecounter(void *dummy) /* warm up new timecounter (again) and get rolling. */ (void)timecounter->tc_get_timecount(timecounter); (void)timecounter->tc_get_timecount(timecounter); - tc_ticktock(NULL); } SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_FIRST, inittimecounter, NULL) diff --git a/sys/sys/timetc.h b/sys/sys/timetc.h index b0090300c57..f0d70d5fc63 100644 --- a/sys/sys/timetc.h +++ b/sys/sys/timetc.h @@ -62,5 +62,6 @@ extern struct timecounter *timecounter; u_int32_t tc_getfrequency(void); void tc_init(struct timecounter *tc); void tc_setclock(struct timespec *ts); +void tc_ticktock(void); #endif /* !_SYS_TIMETC_H_ */