summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-02-05 20:44:56 +0000
committerphk <phk@FreeBSD.org>2002-02-05 20:44:56 +0000
commitd0f44978bc7960bcc2c2286a05177c175f11926e (patch)
tree7b036147cc2b4401d165c279c86d259a0abc9809 /sys
parent703a63d1902599c418445a038cfb17292b123d97 (diff)
downloadFreeBSD-src-d0f44978bc7960bcc2c2286a05177c175f11926e.zip
FreeBSD-src-d0f44978bc7960bcc2c2286a05177c175f11926e.tar.gz
Let the number of timecounters follow hz, otherwise people with
HZ=BIGNUM will strain the assumptions behind timecounters to the point where they break. This may or may not help people seeing microuptime() backwards messages. Make the global timecounter variable volatile, it makes no difference in the code GCC generates, but it makes represents the intent correctly. Thanks to: jdp MFC after: 2 weeks
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_tc.c5
-rw-r--r--sys/sys/timetc.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 92e11c3..fa1832a 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -24,7 +24,7 @@
* Number of timecounters used to implement stable storage
*/
#ifndef NTIMECOUNTER
-#define NTIMECOUNTER 45
+#define NTIMECOUNTER hz
#endif
static MALLOC_DEFINE(M_TIMECOUNTER, "timecounter",
@@ -80,7 +80,7 @@ static struct timecounter dummy_timecounter = {
"dummy"
};
-struct timecounter *timecounter = &dummy_timecounter;
+struct timecounter *volatile timecounter = &dummy_timecounter;
static __inline unsigned
tco_delta(struct timecounter *tc)
@@ -263,6 +263,7 @@ tc_init(struct timecounter *tc)
tc->tc_other = t1;
*t1 = *tc;
t2 = t1;
+ t3 = NULL;
for (i = 1; i < NTIMECOUNTER; i++) {
MALLOC(t3, struct timecounter *, sizeof *t3,
M_TIMECOUNTER, M_WAITOK);
diff --git a/sys/sys/timetc.h b/sys/sys/timetc.h
index ac62dc7..9897f4d 100644
--- a/sys/sys/timetc.h
+++ b/sys/sys/timetc.h
@@ -93,7 +93,7 @@ struct timecounter {
};
#ifdef _KERNEL
-extern struct timecounter *timecounter;
+extern struct timecounter *volatile timecounter;
void tc_init __P((struct timecounter *tc));
void tc_setclock __P((struct timespec *ts));
OpenPOWER on IntegriCloud