diff options
author | jeff <jeff@FreeBSD.org> | 2003-10-16 08:53:46 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-10-16 08:53:46 +0000 |
commit | 4aea3a9433e80a27ebfdc96bbf34edc628c9749b (patch) | |
tree | 58676b73754d9322936b32b75441e5fb2dec634e /sys/kern/sched_4bsd.c | |
parent | 991febf6dd83fc12812470ce7a43503ff2b86f2c (diff) | |
download | FreeBSD-src-4aea3a9433e80a27ebfdc96bbf34edc628c9749b.zip FreeBSD-src-4aea3a9433e80a27ebfdc96bbf34edc628c9749b.tar.gz |
- Collapse sched_switchin() and sched_switchout() into sched_switch(). Now
mi_switch() calls sched_switch() which calls cpu_switch(). This is
actually one less function call than it had been.
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r-- | sys/kern/sched_4bsd.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 7f11c4b..542dce4 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -564,16 +564,10 @@ sched_sleep(struct thread *td, u_char prio) } void -sched_switchin(struct thread *td) -{ - - mtx_assert(&sched_lock, MA_OWNED); - td->td_oncpu = PCPU_GET(cpuid); -} - -void -sched_switchout(struct thread *td) +sched_switch(struct thread *td) { + struct thread *newtd; + u_long sched_nest; struct kse *ke; struct proc *p; @@ -603,6 +597,13 @@ sched_switchout(struct thread *td) */ kse_reassign(ke); } + sched_nest = sched_lock.mtx_recurse; + newtd = choosethread(); + if (td != newtd) + cpu_switch(td, newtd); + sched_lock.mtx_recurse = sched_nest; + sched_lock.mtx_lock = (uintptr_t)td; + td->td_oncpu = PCPU_GET(cpuid); } void |