summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2003-10-29 15:23:09 +0000
committerbde <bde@FreeBSD.org>2003-10-29 15:23:09 +0000
commitf03fdf4e6f72e03157644c21db247f3b5888b214 (patch)
treec9964729ff422b3a8d88cf09e6dd186a0e8b1e59 /sys/kern
parent5dd57a3567c7d0579b6f15c074cadeb424e388b2 (diff)
downloadFreeBSD-src-f03fdf4e6f72e03157644c21db247f3b5888b214.zip
FreeBSD-src-f03fdf4e6f72e03157644c21db247f3b5888b214.tar.gz
Removed mostly-dead code for setting switchtime after the idle loop
clobbers this variable. Long ago, when the idle loop wasn't in a process, it set switchtime.tv_sec to zero to indicate that the time needs to be read after the idle loop finishes. The special case for this isn't needed now that there is an idle process (for each CPU). The time is read in the normal way when the idle process is switched away from. The seconds component of the time is only zero for the first second after the uptime is set, and the mostly-dead code was only executed during this time. (This was slightly broken by using uptimes instead of times relative to the Epoch -- in the original version the seconds component of the time was only 0 for the first second after the Epoch.) In mi_switch(), moved the setting of switchticks to just after the first (and now only) setting of switchtime. This setting used to be delayed since a late setting was needed for the idle case and an early setting was not needed. Now the early setting is needed so that fork_exit() doesn't need to set either switchtime or switchticks. Removed now-completely-rotted comment attached to this. Most of the code described by the comment had already moved to sched_switch().
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c3
-rw-r--r--sys/kern/kern_synch.c10
2 files changed, 2 insertions, 11 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 94b2553..de2c483 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -782,9 +782,6 @@ fork_exit(callout, arg, frame)
cpu_critical_fork_exit();
CTR3(KTR_PROC, "fork_exit: new thread %p (pid %d, %s)", td, p->p_pid,
p->p_comm);
- if (PCPU_GET(switchtime.sec) == 0)
- binuptime(PCPU_PTR(switchtime));
- PCPU_SET(switchticks, ticks);
mtx_unlock_spin(&sched_lock);
/*
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 1b05640..c0bab3b 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -506,22 +506,16 @@ mi_switch(void)
*/
cnt.v_swtch++;
PCPU_SET(switchtime, new_switchtime);
+ PCPU_SET(switchticks, ticks);
CTR3(KTR_PROC, "mi_switch: old thread %p (pid %d, %s)", td, p->p_pid,
p->p_comm);
if (td->td_proc->p_flag & P_SA)
thread_switchout(td);
sched_switch(td);
- /*
- * Start setting up stats etc. for the incoming thread.
- * Similar code in fork_exit() is returned to by cpu_switch()
- * in the case of a new thread/process.
- */
CTR3(KTR_PROC, "mi_switch: new thread %p (pid %d, %s)", td, p->p_pid,
p->p_comm);
- if (PCPU_GET(switchtime.sec) == 0)
- binuptime(PCPU_PTR(switchtime));
- PCPU_SET(switchticks, ticks);
+
/*
* If the last thread was exiting, finish cleaning it up.
*/
OpenPOWER on IntegriCloud