summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_turnstile.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-12-09 21:14:31 +0000
committerjhb <jhb@FreeBSD.org>2003-12-09 21:14:31 +0000
commitd8b6cc614acde625494abf1ad24f374fdcb0eb2a (patch)
treef2dca52d326a4f64914ca173ebf3a8321ac26b6c /sys/kern/subr_turnstile.c
parentf110a9ab64ec722689aec2bb4fcb522150e0c81c (diff)
downloadFreeBSD-src-d8b6cc614acde625494abf1ad24f374fdcb0eb2a.zip
FreeBSD-src-d8b6cc614acde625494abf1ad24f374fdcb0eb2a.tar.gz
Adjust an assertion for the TDF_TSNOBLOCK race handling in
turnstile_unpend(). A racing thread that does not have TDI_LOCK set may either be running on another CPU or it may be sitting on a run queue if it was preempted during the very small window in turnstile_wait() between unlocking the turnstile chain lock and locking sched_lock.
Diffstat (limited to 'sys/kern/subr_turnstile.c')
-rw-r--r--sys/kern/subr_turnstile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c
index 54458ef..1f877f4 100644
--- a/sys/kern/subr_turnstile.c
+++ b/sys/kern/subr_turnstile.c
@@ -672,7 +672,8 @@ turnstile_unpend(struct turnstile *ts)
/*
* Wake up all the pending threads. If a thread is not blocked
* on a lock, then it is currently executing on another CPU in
- * turnstile_wait(). Set a flag to force it to try to acquire
+ * turnstile_wait() or sitting on a run queue waiting to resume
+ * in turnstile_wait(). Set a flag to force it to try to acquire
* the lock again instead of blocking.
*/
while (!TAILQ_EMPTY(&pending_threads)) {
@@ -687,7 +688,7 @@ turnstile_unpend(struct turnstile *ts)
setrunqueue(td);
} else {
td->td_flags |= TDF_TSNOBLOCK;
- MPASS(TD_IS_RUNNING(td));
+ MPASS(TD_IS_RUNNING(td) || TD_ON_RUNQ(td));
}
}
mtx_unlock_spin(&sched_lock);
OpenPOWER on IntegriCloud