aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_kthread.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2015-02-28 04:19:02 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2015-02-28 04:19:02 +0000
commit13dad108711bc127409ad7985aade0afce873743 (patch)
tree6927f903734161bc2d6ba87a115a0c175ec8f6c7 /sys/kern/kern_kthread.c
parentc483877531068b3bf30bdc02a103c1fa2b57a215 (diff)
downloadsrc-13dad108711bc127409ad7985aade0afce873743.tar.gz
src-13dad108711bc127409ad7985aade0afce873743.zip
The umtx_lock mutex is used by top-half of the kernel, but is
currently a spin lock. Apparently, the only reason for this is that umtx_thread_exit() is called under the process spinlock, which put the requirement on the umtx_lock. Note that the witness static order list is wrong for the umtx_lock, umtx_lock is explicitely before any thread lock, so it is also before sleepq locks. Change umtx_lock to be the sleepable mutex. For the reason above, the calls to umtx_thread_exit() are moved from thread_exit() earlier in each caller, when the process spin lock is not yet taken. Discussed with: jhb Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=279390
Diffstat (limited to 'sys/kern/kern_kthread.c')
-rw-r--r--sys/kern/kern_kthread.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index 969c513eb8fe..ee94de0e78a5 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rwlock.h>
#include <sys/signalvar.h>
#include <sys/sx.h>
+#include <sys/umtx.h>
#include <sys/unistd.h>
#include <sys/wait.h>
#include <sys/sched.h>
@@ -339,6 +340,7 @@ kthread_exit(void)
}
LIST_REMOVE(curthread, td_hash);
rw_wunlock(&tidhash_lock);
+ umtx_thread_exit(curthread);
PROC_SLOCK(p);
thread_exit();
}