aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1999-02-28 10:53:29 +0000
committerBruce Evans <bde@FreeBSD.org>1999-02-28 10:53:29 +0000
commite7ba67f27485aafd7de82a338405f1930ba60c09 (patch)
treef1e7da3dd15d7030487b9716c9646301244fc73e /sys
parent5419aa3ecf3adc54fb13111cd24ff94ab92fda95 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/genassym.c3
-rw-r--r--sys/alpha/alpha/swtch.s7
-rw-r--r--sys/amd64/amd64/exception.S20
-rw-r--r--sys/amd64/amd64/exception.s20
-rw-r--r--sys/amd64/amd64/genassym.c3
-rw-r--r--sys/i386/i386/exception.s20
-rw-r--r--sys/i386/i386/genassym.c3
-rw-r--r--sys/kern/init_main.c4
-rw-r--r--sys/kern/kern_resource.c6
-rw-r--r--sys/kern/kern_synch.c16
-rw-r--r--sys/powerpc/powerpc/genassym.c3
-rw-r--r--sys/sys/proc.h3
12 files changed, 40 insertions, 68 deletions
diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c
index 33febfcfeb611..19adb45196703 100644
--- a/sys/alpha/alpha/genassym.c
+++ b/sys/alpha/alpha/genassym.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
- * $Id: genassym.c,v 1.3 1998/07/12 16:08:15 dfr Exp $
+ * $Id: genassym.c,v 1.4 1998/11/15 18:25:15 dfr Exp $
*/
#include <sys/param.h>
@@ -94,7 +94,6 @@ main()
OFF(P_WCHAN, struct proc, p_wchan);
OFF(P_FLAG, struct proc, p_flag);
OFF(P_PID, struct proc, p_pid);
- OFF(P_SWITCHTIME, struct proc, p_switchtime);
OFF(P_RUNTIME, struct proc, p_runtime);
OFF(P_MD_FLAGS, struct proc, p_md.md_flags);
OFF(P_MD_PCBPADDR, struct proc, p_md.md_pcbpaddr);
diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s
index ab3f996d6f1ee..7cd3192ce677c 100644
--- a/sys/alpha/alpha/swtch.s
+++ b/sys/alpha/alpha/swtch.s
@@ -1,4 +1,4 @@
-/* $Id: swtch.s,v 1.6 1998/11/15 18:25:15 dfr Exp $ */
+/* $Id: swtch.s,v 1.7 1998/12/02 10:24:56 dfr Exp $ */
/* $NetBSD: locore.s,v 1.47 1998/03/22 07:26:32 thorpej Exp $ */
/*
@@ -265,11 +265,6 @@ Lcs7:
* pointer to the executing process's proc structure.
*/
LEAF(switch_trampoline, 0)
- ldq a0, curproc
- ldiq a1, P_SWITCHTIME
- addq a0, a1, a0
- CALL(microuptime)
-
mov s0, pv
mov s1, ra
mov s2, a0
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index 1b4663cd78c24..79e1d1a7d0ac1 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: exception.s,v 1.55 1998/08/10 19:41:07 bde Exp $
+ * $Id: exception.s,v 1.56 1999/02/25 11:03:08 bde Exp $
*/
#include "npx.h"
@@ -312,23 +312,17 @@ IDTVEC(int0x80_syscall)
ENTRY(fork_trampoline)
call _spl0
- movl _curproc,%eax
- addl $P_SWITCHTIME,%eax
- movl _switchtime,%ecx
- testl %ecx,%ecx
+
+#ifdef SMP
+ cmpl $0,_switchtime
jne 1f
- /* XXX unreachable except in the SMP case? */
- pushl %eax
+ pushl $_switchtime
call _microuptime
- popl %eax
+ popl %edx
movl _ticks,%eax
movl %eax,_switchticks
- jmp 2f
1:
- movl %ecx,(%eax)
- movl _switchtime+4,%edx
- movl %edx,4(%eax)
-2:
+#endif
/*
* cpu_set_fork_handler intercepts this function call to
diff --git a/sys/amd64/amd64/exception.s b/sys/amd64/amd64/exception.s
index 1b4663cd78c24..79e1d1a7d0ac1 100644
--- a/sys/amd64/amd64/exception.s
+++ b/sys/amd64/amd64/exception.s
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: exception.s,v 1.55 1998/08/10 19:41:07 bde Exp $
+ * $Id: exception.s,v 1.56 1999/02/25 11:03:08 bde Exp $
*/
#include "npx.h"
@@ -312,23 +312,17 @@ IDTVEC(int0x80_syscall)
ENTRY(fork_trampoline)
call _spl0
- movl _curproc,%eax
- addl $P_SWITCHTIME,%eax
- movl _switchtime,%ecx
- testl %ecx,%ecx
+
+#ifdef SMP
+ cmpl $0,_switchtime
jne 1f
- /* XXX unreachable except in the SMP case? */
- pushl %eax
+ pushl $_switchtime
call _microuptime
- popl %eax
+ popl %edx
movl _ticks,%eax
movl %eax,_switchticks
- jmp 2f
1:
- movl %ecx,(%eax)
- movl _switchtime+4,%edx
- movl %edx,4(%eax)
-2:
+#endif
/*
* cpu_set_fork_handler intercepts this function call to
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index 0da064fcf974c..25ea72f4800e7 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
- * $Id: genassym.c,v 1.62 1998/10/08 21:03:41 msmith Exp $
+ * $Id: genassym.c,v 1.63 1999/02/22 15:13:34 bde Exp $
*/
#include "opt_vm86.h"
@@ -92,7 +92,6 @@ main()
printf("#define\tP_WCHAN %#x\n", OS(proc, p_wchan));
printf("#define\tP_FLAG %#x\n", OS(proc, p_flag));
printf("#define\tP_PID %#x\n", OS(proc, p_pid));
- printf("#define\tP_SWITCHTIME %#x\n", OS(proc, p_switchtime));
#ifdef SMP
printf("#define\tP_ONCPU %#x\n", OS(proc, p_oncpu));
printf("#define\tP_LASTCPU %#x\n", OS(proc, p_lastcpu));
diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index 1b4663cd78c24..79e1d1a7d0ac1 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: exception.s,v 1.55 1998/08/10 19:41:07 bde Exp $
+ * $Id: exception.s,v 1.56 1999/02/25 11:03:08 bde Exp $
*/
#include "npx.h"
@@ -312,23 +312,17 @@ IDTVEC(int0x80_syscall)
ENTRY(fork_trampoline)
call _spl0
- movl _curproc,%eax
- addl $P_SWITCHTIME,%eax
- movl _switchtime,%ecx
- testl %ecx,%ecx
+
+#ifdef SMP
+ cmpl $0,_switchtime
jne 1f
- /* XXX unreachable except in the SMP case? */
- pushl %eax
+ pushl $_switchtime
call _microuptime
- popl %eax
+ popl %edx
movl _ticks,%eax
movl %eax,_switchticks
- jmp 2f
1:
- movl %ecx,(%eax)
- movl _switchtime+4,%edx
- movl %edx,4(%eax)
-2:
+#endif
/*
* cpu_set_fork_handler intercepts this function call to
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index 0da064fcf974c..25ea72f4800e7 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
- * $Id: genassym.c,v 1.62 1998/10/08 21:03:41 msmith Exp $
+ * $Id: genassym.c,v 1.63 1999/02/22 15:13:34 bde Exp $
*/
#include "opt_vm86.h"
@@ -92,7 +92,6 @@ main()
printf("#define\tP_WCHAN %#x\n", OS(proc, p_wchan));
printf("#define\tP_FLAG %#x\n", OS(proc, p_flag));
printf("#define\tP_PID %#x\n", OS(proc, p_pid));
- printf("#define\tP_SWITCHTIME %#x\n", OS(proc, p_switchtime));
#ifdef SMP
printf("#define\tP_ONCPU %#x\n", OS(proc, p_oncpu));
printf("#define\tP_LASTCPU %#x\n", OS(proc, p_lastcpu));
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 26901129f1e93..671bfb77f851b 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
- * $Id: init_main.c,v 1.109 1999/02/19 14:25:34 luoqi Exp $
+ * $Id: init_main.c,v 1.110 1999/02/25 11:03:08 bde Exp $
*/
#include "opt_devfs.h"
@@ -495,7 +495,7 @@ proc0_post(dummy)
*/
microtime(&proc0.p_stats->p_start);
proc0.p_runtime = 0;
- microuptime(&proc0.p_switchtime);
+ microuptime(&switchtime);
switchticks = ticks;
/*
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index 7ab0eccfac73c..2fee8f8ae0591 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
- * $Id: kern_resource.c,v 1.40 1999/01/31 03:15:13 newton Exp $
+ * $Id: kern_resource.c,v 1.41 1999/02/25 11:03:08 bde Exp $
*/
#include "opt_compat.h"
@@ -523,8 +523,8 @@ calcru(p, up, sp, ip)
* quantum, which is much greater than the sampling error.
*/
microuptime(&tv);
- totusec += (tv.tv_usec - p->p_switchtime.tv_usec) +
- (tv.tv_sec - p->p_switchtime.tv_sec) * (int64_t)1000000;
+ totusec += (tv.tv_usec - switchtime.tv_usec) +
+ (tv.tv_sec - switchtime.tv_sec) * (int64_t)1000000;
/*
* Copy the time that was just read to `switchtime' in case
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index bea45f72dc9e8..8473adee433e1 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);
diff --git a/sys/powerpc/powerpc/genassym.c b/sys/powerpc/powerpc/genassym.c
index 33febfcfeb611..19adb45196703 100644
--- a/sys/powerpc/powerpc/genassym.c
+++ b/sys/powerpc/powerpc/genassym.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
- * $Id: genassym.c,v 1.3 1998/07/12 16:08:15 dfr Exp $
+ * $Id: genassym.c,v 1.4 1998/11/15 18:25:15 dfr Exp $
*/
#include <sys/param.h>
@@ -94,7 +94,6 @@ main()
OFF(P_WCHAN, struct proc, p_wchan);
OFF(P_FLAG, struct proc, p_flag);
OFF(P_PID, struct proc, p_pid);
- OFF(P_SWITCHTIME, struct proc, p_switchtime);
OFF(P_RUNTIME, struct proc, p_runtime);
OFF(P_MD_FLAGS, struct proc, p_md.md_flags);
OFF(P_MD_PCBPADDR, struct proc, p_md.md_pcbpaddr);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 03e9920938818..53eef6d79f266 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)proc.h 8.15 (Berkeley) 5/19/95
- * $Id: proc.h,v 1.70 1999/02/22 16:57:48 bde Exp $
+ * $Id: proc.h,v 1.71 1999/02/25 14:28:46 newton Exp $
*/
#ifndef _SYS_PROC_H_
@@ -159,7 +159,6 @@ struct proc {
struct itimerval p_realtimer; /* Alarm timer. */
u_int64_t p_runtime; /* Real time in microsec. */
- struct timeval p_switchtime; /* When last scheduled */
u_quad_t p_uticks; /* Statclock hits in user mode. */
u_quad_t p_sticks; /* Statclock hits in system mode. */
u_quad_t p_iticks; /* Statclock hits processing intr. */