summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2001-02-22 19:50:37 +0000
committertegge <tegge@FreeBSD.org>2001-02-22 19:50:37 +0000
commitb3140862f54f556a07bb57298f0327c9b95770fa (patch)
treef1ca938763e2df7f60784b681f858c0ee2a4f244 /sys/kern/kern_exit.c
parented410f8195c01d68645b4a52e9bafa354044106f (diff)
downloadFreeBSD-src-b3140862f54f556a07bb57298f0327c9b95770fa.zip
FreeBSD-src-b3140862f54f556a07bb57298f0327c9b95770fa.tar.gz
Protect update of the per processor switchtime variable against
interrupts. Protect usage of the per processor switchtime variable against interrupts in calcru(). This seem to eliminate the "microuptime() went backwards" warnings.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 440ee3a..08cbb28 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -118,6 +118,7 @@ exit1(p, rv)
register struct proc *q, *nq;
register struct vmspace *vm;
struct exitlist *ep;
+ struct timeval new_switchtime;
if (p->p_pid == 1) {
printf("init died (signal %d, exit %d)\n",
@@ -325,7 +326,10 @@ exit1(p, rv)
* directly. Set it now so that the rest of the exit time gets
* counted somewhere if possible.
*/
- microuptime(PCPU_PTR(switchtime));
+ mtx_lock_spin(&sched_lock);
+ microuptime(&new_switchtime);
+ PCPU_SET(switchtime, new_switchtime);
+ mtx_unlock_spin(&sched_lock);
PCPU_SET(switchticks, ticks);
/*
OpenPOWER on IntegriCloud