summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2004-09-13 23:02:52 +0000
committerjulian <julian@FreeBSD.org>2004-09-13 23:02:52 +0000
commit0b88c839d555724051b01c0e9d0addecb4f57c64 (patch)
treefc1f77a805bb10b418389426119d6b3bae795f89 /sys
parent53023d01b3b86e0e4af788f3ff8408b453abb8a2 (diff)
downloadFreeBSD-src-0b88c839d555724051b01c0e9d0addecb4f57c64.zip
FreeBSD-src-0b88c839d555724051b01c0e9d0addecb4f57c64.tar.gz
Add some kasserts
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_switch.c4
-rw-r--r--sys/kern/sched_4bsd.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c
index 9841f2a..b937f8a 100644
--- a/sys/kern/kern_switch.c
+++ b/sys/kern/kern_switch.c
@@ -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) ||
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index c1a1c6b..02c8f3c 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -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);
OpenPOWER on IntegriCloud