Add some kasserts

This commit is contained in:
Julian Elischer 2004-09-13 23:02:52 +00:00
parent 077c971c86
commit b2578c6c06
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135181
2 changed files with 6 additions and 0 deletions

View File

@ -331,6 +331,8 @@ setrunqueue(struct thread *td, int flags)
CTR3(KTR_RUNQ, "setrunqueue: td:%p kg:%p pid:%d",
td, td->td_ksegrp, td->td_proc->p_pid);
mtx_assert(&sched_lock, MA_OWNED);
KASSERT((td->td_inhibitors == 0),
("setrunqueue: trying to run inhibitted thread"));
KASSERT((TD_CAN_RUN(td) || TD_IS_RUNNING(td)),
("setrunqueue: bad thread state"));
TD_SET_RUNQ(td);
@ -504,6 +506,8 @@ maybe_preempt(struct thread *td)
ctd = curthread;
KASSERT ((ctd->td_kse != NULL && ctd->td_kse->ke_thread == ctd),
("thread has no (or wrong) sched-private part."));
KASSERT((td->td_inhibitors == 0),
("maybe_preempt: trying to run inhibitted thread"));
pri = td->td_priority;
cpri = ctd->td_priority;
if (pri >= cpri || cold /* || dumping */ || TD_IS_INHIBITED(ctd) ||

View File

@ -794,6 +794,8 @@ sched_switch(struct thread *td, struct thread *newtd, int flags)
* added to the run queue and selected.
*/
if (newtd) {
KASSERT((newtd->td_inhibitors == 0),
("trying to run inhibitted thread"));
newtd->td_ksegrp->kg_avail_opennings--;
newtd->td_kse->ke_flags |= KEF_DIDRUN;
TD_SET_RUNNING(newtd);