diff options
author | davidxu <davidxu@FreeBSD.org> | 2006-02-23 00:13:58 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2006-02-23 00:13:58 +0000 |
commit | e29c8e080b595587aafe2e1d02c5eb9f9f322a51 (patch) | |
tree | 7e38ae2e71791b901f46413e77ea39d2b4ba7ae0 /sys/kern/kern_synch.c | |
parent | ff94f53a5d7abb067a90f6013082aaa99474583d (diff) | |
download | FreeBSD-src-e29c8e080b595587aafe2e1d02c5eb9f9f322a51.zip FreeBSD-src-e29c8e080b595587aafe2e1d02c5eb9f9f322a51.tar.gz |
Fix a sleep queue race for KSE thread.
Reviewed by: jhb
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index f988946..d2c6acc 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -164,22 +164,11 @@ msleep(ident, mtx, priority, wmesg, timo) if (TD_ON_SLEEPQ(td)) sleepq_remove(td, td->td_wchan); + flags = SLEEPQ_MSLEEP; + if (catch) + flags |= SLEEPQ_INTERRUPTIBLE; + sleepq_lock(ident); - if (catch) { - /* - * Don't bother sleeping if we are exiting and not the exiting - * thread or if our thread is marked as interrupted. - */ - mtx_lock_spin(&sched_lock); - rval = thread_sleep_check(td); - mtx_unlock_spin(&sched_lock); - if (rval != 0) { - sleepq_release(ident); - if (mtx != NULL && priority & PDROP) - mtx_unlock(mtx); - return (rval); - } - } CTR5(KTR_PROC, "msleep: thread %p (pid %ld, %s) on %s (%p)", (void *)td, (long)p->p_pid, p->p_comm, wmesg, ident); @@ -199,9 +188,6 @@ msleep(ident, mtx, priority, wmesg, timo) * stopped, then td will no longer be on a sleep queue upon * return from cursig(). */ - flags = SLEEPQ_MSLEEP; - if (catch) - flags |= SLEEPQ_INTERRUPTIBLE; sleepq_add(ident, mtx, wmesg, flags); if (timo) sleepq_set_timeout(ident, timo); |