1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

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
This commit is contained in:
Attilio Rao 2010-01-24 18:16:38 +00:00
parent e7f82fbbaf
commit 58060789e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202940

View File

@ -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