svn commit: r331536 - head/sys/kern

Mark Johnston markj at FreeBSD.org
Sun Mar 25 20:12:15 UTC 2018


Author: markj
Date: Sun Mar 25 20:12:14 2018
New Revision: 331536
URL: https://svnweb.freebsd.org/changeset/base/331536

Log:
  Use LIST_FOREACH_SAFE in sleepq_chains_remove_matching().
  
  We may remove a sleepqueue from the hash table in
  sleepq_resume_thread().
  
  Reviewed by:	kib
  MFC after:	3 days
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D14847

Modified:
  head/sys/kern/subr_sleepqueue.c

Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c	Sun Mar 25 18:10:00 2018	(r331535)
+++ head/sys/kern/subr_sleepqueue.c	Sun Mar 25 20:12:14 2018	(r331536)
@@ -1103,7 +1103,7 @@ void
 sleepq_chains_remove_matching(bool (*matches)(struct thread *))
 {
 	struct sleepqueue_chain *sc;
-	struct sleepqueue *sq;
+	struct sleepqueue *sq, *sq1;
 	int i, wakeup_swapper;
 
 	wakeup_swapper = 0;
@@ -1112,7 +1112,7 @@ sleepq_chains_remove_matching(bool (*matches)(struct t
 			continue;
 		}
 		mtx_lock_spin(&sc->sc_lock);
-		LIST_FOREACH(sq, &sc->sc_queues, sq_hash) {
+		LIST_FOREACH_SAFE(sq, &sc->sc_queues, sq_hash, sq1) {
 			for (i = 0; i < NR_SLEEPQS; ++i) {
 				wakeup_swapper |= sleepq_remove_matching(sq, i,
 				    matches, 0);


More information about the svn-src-head mailing list