diff options
author | mav <mav@FreeBSD.org> | 2010-09-14 08:48:06 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2010-09-14 08:48:06 +0000 |
commit | 6c05aa4db6d1ea20da8eca83a1214b74821b32d8 (patch) | |
tree | ad6e771c5b5091a633bf1f813ca1f742162ecb96 /sys/kern/kern_tc.c | |
parent | 5864d6e457c81a0a80b2ab3b57ee852e6f62efcb (diff) | |
download | FreeBSD-src-6c05aa4db6d1ea20da8eca83a1214b74821b32d8.zip FreeBSD-src-6c05aa4db6d1ea20da8eca83a1214b74821b32d8.tar.gz |
Make kern_tc.c provide minimum frequency of tc_ticktock() calls, required
to handle current timecounter wraps. Make kern_clocksource.c to honor that
requirement, scheduling sleeps on first CPU for no more then specified
period. Allow other CPUs to sleep up to 1/4 second (for any case).
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r-- | sys/kern/kern_tc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 811b24f..7a34a52 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -87,6 +87,8 @@ static struct timehands *volatile timehands = &th0; struct timecounter *timecounter = &dummy_timecounter; static struct timecounter *timecounters = &dummy_timecounter; +int tc_min_ticktock_freq = 1; + time_t time_second = 1; time_t time_uptime = 1; @@ -482,6 +484,8 @@ tc_windup(void) if (th->th_counter != timecounter) { th->th_counter = timecounter; th->th_offset_count = ncount; + tc_min_ticktock_freq = max(1, timecounter->tc_frequency / + (((uint64_t)timecounter->tc_counter_mask + 1) / 3)); } /*- @@ -767,11 +771,12 @@ static int tc_tick; SYSCTL_INT(_kern_timecounter, OID_AUTO, tick, CTLFLAG_RD, &tc_tick, 0, ""); void -tc_ticktock(void) +tc_ticktock(int cnt) { static int count; - if (++count < tc_tick) + count += cnt; + if (count < tc_tick) return; count = 0; tc_windup(); |