summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clock.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2013-01-28 19:38:13 +0000
committerjhb <jhb@FreeBSD.org>2013-01-28 19:38:13 +0000
commit5df972afb615beef2123a19aeca58e473e3d4e95 (patch)
tree380f661c837f03bdedc0e10252427ed4cde7ed7d /sys/kern/kern_clock.c
parent7756bef786978bd5d07c05b55bc8428454d6837d (diff)
downloadFreeBSD-src-5df972afb615beef2123a19aeca58e473e3d4e95.zip
FreeBSD-src-5df972afb615beef2123a19aeca58e473e3d4e95.tar.gz
Mark 'ticks', 'time_second', and 'time_uptime' as volatile to prevent the
compiler from caching their values in tight loops. Reviewed by: bde MFC after: 1 week
Diffstat (limited to 'sys/kern/kern_clock.c')
-rw-r--r--sys/kern/kern_clock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 5e10200..9d62c58 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -382,7 +382,7 @@ static void watchdog_config(void *, u_int, int *);
int stathz;
int profhz;
int profprocs;
-int ticks;
+volatile int ticks;
int psratio;
static DPCPU_DEFINE(int, pcputicks); /* Per-CPU version of ticks. */
@@ -469,7 +469,7 @@ void
hardclock(int usermode, uintfptr_t pc)
{
- atomic_add_int((volatile int *)&ticks, 1);
+ atomic_add_int(&ticks, 1);
hardclock_cpu(usermode);
tc_ticktock(1);
cpu_tick_calibration();
OpenPOWER on IntegriCloud