From 58060789e6aec9b3fb5e91d8ed344d34887a22cc Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Sun, 24 Jan 2010 18:16:38 +0000 Subject: Split out an invariant in order to better check that newtd, when provided, must be on a runqueue. Tested by: Giovanni Trematerra MFC: 2 weeks X-MFC: r202889 --- sys/kern/sched_4bsd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/kern/sched_4bsd.c') diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index bcec5b9205dd..cf215f5355dd 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -943,8 +943,10 @@ sched_switch(struct thread *td, struct thread *newtd, int flags) if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_rem(); - if (newtd) + if (newtd) { + MPASS(newtd->td_lock == &sched_lock); newtd->td_flags |= (td->td_flags & TDF_NEEDRESCHED); + } td->td_lastcpu = td->td_oncpu; td->td_flags &= ~TDF_NEEDRESCHED; @@ -987,8 +989,8 @@ sched_switch(struct thread *td, struct thread *newtd, int flags) sched_load_add(); } else { newtd = choosethread(); + MPASS(newtd->td_lock == &sched_lock); } - MPASS(newtd->td_lock == &sched_lock); if (td != newtd) { #ifdef HWPMC_HOOKS -- cgit v1.2.3