summaryrefslogtreecommitdiffstats
path: root/sys/kern/sched_4bsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r--sys/kern/sched_4bsd.c19
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
OpenPOWER on IntegriCloud