Add a comment explaining the race fixed by r310423.

Suggested and reviewed by: jhb
X-MFC With:	r310423
This commit is contained in:
Mark Johnston 2016-12-23 05:02:17 +00:00
parent a3dc138e75
commit eab80d9276

View File

@ -892,7 +892,12 @@ sleepq_broadcast(void *wchan, int flags, int pri, int queue)
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);