summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-07-28 17:55:37 +0000
committerbde <bde@FreeBSD.org>1998-07-28 17:55:37 +0000
commit959a234634b39d656cfb802c3ab919c07e287f69 (patch)
tree3ac1bda16a02d5f378aad7b3c025d4324fcb7743 /sys
parent09a9db632f0ddf1b731633685ad0e7c70d0d584d (diff)
downloadFreeBSD-src-959a234634b39d656cfb802c3ab919c07e287f69.zip
FreeBSD-src-959a234634b39d656cfb802c3ab919c07e287f69.tar.gz
Set p->p_switchtime to switchtime instead of to the current time in
fork_trampoline() if switchtime is valid. This fixes not accounting for the time between the previous context switch and and the current time (when the forked child starts up here) in most cases - the time is now counted in the child's runtime. I think it actually fixes all cases, and switchtime is always valid here, since there must have been a context switch just before the forked child starts up. Some code should be removed if this is correct. The check that switchtime is valid sometimes gives a false negative because the check isn't correct until the after the first context switch after the system has been up for >= 1 second.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/exception.S12
-rw-r--r--sys/amd64/amd64/exception.s12
-rw-r--r--sys/i386/i386/exception.s12
3 files changed, 33 insertions, 3 deletions
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index 9802230..f2133f6 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.52 1998/05/17 11:51:53 phk Exp $
+ * $Id: exception.s,v 1.53 1998/05/28 09:29:54 phk Exp $
*/
#include "npx.h"
@@ -345,9 +345,19 @@ ENTRY(fork_trampoline)
call _spl0
movl _curproc,%eax
addl $P_SWITCHTIME,%eax
+ movl _switchtime,%ecx
+ testl %ecx,%ecx
+ jne 1f
+ /* XXX unreachable? */
pushl %eax
call _microuptime
popl %eax
+ jmp 2f
+1:
+ movl %ecx,(%eax)
+ movl _switchtime+4,%edx
+ movl %edx,4(%eax)
+2:
/*
* cpu_set_fork_handler intercepts this function call to
diff --git a/sys/amd64/amd64/exception.s b/sys/amd64/amd64/exception.s
index 9802230..f2133f6 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.52 1998/05/17 11:51:53 phk Exp $
+ * $Id: exception.s,v 1.53 1998/05/28 09:29:54 phk Exp $
*/
#include "npx.h"
@@ -345,9 +345,19 @@ ENTRY(fork_trampoline)
call _spl0
movl _curproc,%eax
addl $P_SWITCHTIME,%eax
+ movl _switchtime,%ecx
+ testl %ecx,%ecx
+ jne 1f
+ /* XXX unreachable? */
pushl %eax
call _microuptime
popl %eax
+ jmp 2f
+1:
+ movl %ecx,(%eax)
+ movl _switchtime+4,%edx
+ movl %edx,4(%eax)
+2:
/*
* cpu_set_fork_handler intercepts this function call to
diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index 9802230..f2133f6 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.52 1998/05/17 11:51:53 phk Exp $
+ * $Id: exception.s,v 1.53 1998/05/28 09:29:54 phk Exp $
*/
#include "npx.h"
@@ -345,9 +345,19 @@ ENTRY(fork_trampoline)
call _spl0
movl _curproc,%eax
addl $P_SWITCHTIME,%eax
+ movl _switchtime,%ecx
+ testl %ecx,%ecx
+ jne 1f
+ /* XXX unreachable? */
pushl %eax
call _microuptime
popl %eax
+ jmp 2f
+1:
+ movl %ecx,(%eax)
+ movl _switchtime+4,%edx
+ movl %edx,4(%eax)
+2:
/*
* cpu_set_fork_handler intercepts this function call to
OpenPOWER on IntegriCloud