diff options
author | bde <bde@FreeBSD.org> | 1999-02-28 10:53:29 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1999-02-28 10:53:29 +0000 |
commit | 6d8d63664b85d83414c7e28ee8e59af676bfa952 (patch) | |
tree | 687f7f8e1cfdf77b73db2ec7f83acef1a466639a /sys/kern/kern_synch.c | |
parent | a9ceb881dea24247c4222bdca9665ff11872a2e6 (diff) | |
download | FreeBSD-src-6d8d63664b85d83414c7e28ee8e59af676bfa952.zip FreeBSD-src-6d8d63664b85d83414c7e28ee8e59af676bfa952.tar.gz |
Removed all traces of `p_switchtime'. The relevant timestamp is per-cpu,
not per-process. Keep it in `switchtime' consistently.
It is now clear that the timestamp is always valid in fork_trampoline()
except when the child is running on a previously idle cpu, which
can only happen if there are multiple cpus, so don't check or set
the timestamp in fork_trampoline except in the (i386) SMP case.
Just remove the alpha code for setting it unconditionally, since
there is no SMP case for alpha and the code had rotted.
Parts reviewed by: dfr, phk
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index bea45f7..8473adee 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 - * $Id: kern_synch.c,v 1.72 1999/01/10 01:58:24 eivind Exp $ + * $Id: kern_synch.c,v 1.73 1999/02/22 16:57:47 bde Exp $ */ #include "opt_ktrace.h" @@ -769,6 +769,7 @@ wakeup_one(ident) void mi_switch() { + struct timeval new_switchtime; register struct proc *p = curproc; /* XXX */ register struct rlimit *rlim; int x; @@ -800,9 +801,9 @@ mi_switch() * Compute the amount of time during which the current * process was running, and add that to its total so far. */ - microuptime(&switchtime); - p->p_runtime += (switchtime.tv_usec - p->p_switchtime.tv_usec) + - (switchtime.tv_sec - p->p_switchtime.tv_sec) * (int64_t)1000000; + microuptime(&new_switchtime); + p->p_runtime += (new_switchtime.tv_usec - switchtime.tv_usec) + + (new_switchtime.tv_sec - switchtime.tv_sec) * (int64_t)1000000; /* * Check if the process exceeds its cpu resource allocation. @@ -826,11 +827,10 @@ mi_switch() * Pick a new current process and record its start time. */ cnt.v_swtch++; + switchtime = new_switchtime; cpu_switch(p); - if (switchtime.tv_sec) - p->p_switchtime = switchtime; - else - microuptime(&p->p_switchtime); + if (switchtime.tv_sec == 0) + microuptime(&switchtime); switchticks = ticks; splx(x); |