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
This commit is contained in:
Mark Johnston 2018-03-25 20:12:14 +00:00
parent e05b3850c7
commit 803c11a3a6

View File

@ -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 thread *))
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);