diff options
author | attilio <attilio@FreeBSD.org> | 2010-01-24 18:16:38 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2010-01-24 18:16:38 +0000 |
commit | 953b6f2ceda959dc1c6dad8bd98f43b3fe5eb1da (patch) | |
tree | 9e8d9637838c6bc18a1e0d1f96b291215bc3c1cb /sys/kern | |
parent | f02d63f34654b1a1e3ed80789fc25aa70f7046c0 (diff) | |
download | FreeBSD-src-953b6f2ceda959dc1c6dad8bd98f43b3fe5eb1da.zip FreeBSD-src-953b6f2ceda959dc1c6dad8bd98f43b3fe5eb1da.tar.gz |
Split out an invariant in order to better check that newtd, when
provided, must be on a runqueue.
Tested by: Giovanni Trematerra
<giovanni dot trematerra at gmail dot com>
MFC: 2 weeks
X-MFC: r202889
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/sched_4bsd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index bcec5b9..cf215f5 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 |