svn commit: r310454 - head/sys/kern
Mark Johnston
markj at FreeBSD.org
Fri Dec 23 05:02:19 UTC 2016
Author: markj
Date: Fri Dec 23 05:02:17 2016
New Revision: 310454
URL: https://svnweb.freebsd.org/changeset/base/310454
Log:
Add a comment explaining the race fixed by r310423.
Suggested and reviewed by: jhb
X-MFC With: r310423
Modified:
head/sys/kern/subr_sleepqueue.c
Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c Fri Dec 23 04:59:22 2016 (r310453)
+++ head/sys/kern/subr_sleepqueue.c Fri Dec 23 05:02:17 2016 (r310454)
@@ -892,7 +892,12 @@ sleepq_broadcast(void *wchan, int flags,
KASSERT(sq->sq_type == (flags & SLEEPQ_TYPE),
("%s: mismatch between sleep/wakeup and cv_*", __func__));
- /* Resume all blocked threads on the sleep queue. */
+ /*
+ * Resume all blocked threads on the sleep queue. The last thread will
+ * be given ownership of sq and may re-enqueue itself before
+ * sleepq_resume_thread() returns, so we must cache the "next" queue
+ * item at the beginning of the final iteration.
+ */
wakeup_swapper = 0;
TAILQ_FOREACH_SAFE(td, &sq->sq_blocked[queue], td_slpq, tdn) {
thread_lock(td);
More information about the svn-src-head
mailing list