summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2007-06-05 18:57:09 +0000
committerattilio <attilio@FreeBSD.org>2007-06-05 18:57:09 +0000
commit8e2bea078c1720a630e35ecbd831eae8ee5e982f (patch)
tree478f51ad93af442f5aa8e44081eaaca6db0ac563 /sys/kern/kern_mutex.c
parent3cd4cdf93df1e3a579d555ed064240f124cf9ece (diff)
downloadFreeBSD-src-8e2bea078c1720a630e35ecbd831eae8ee5e982f.zip
FreeBSD-src-8e2bea078c1720a630e35ecbd831eae8ee5e982f.tar.gz
Fix a problem with not-preemptive kernels caming from mis-merging of
existing code with the new thread_lock patch. This also cleans up a bit unlock operation for mutexes. Approved by: jhb, jeff(mentor)
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c47
1 files changed, 0 insertions, 47 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index b717454..a144062 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -580,9 +580,6 @@ void
_mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line)
{
struct turnstile *ts;
-#ifndef PREEMPTION
- struct thread *td, *td1;
-#endif
if (mtx_recursed(m)) {
if (--(m->mtx_recurse) == 0)
@@ -612,10 +609,6 @@ _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line)
#else
MPASS(ts != NULL);
#endif
-#ifndef PREEMPTION
- /* XXX */
- td1 = turnstile_head(ts, TS_EXCLUSIVE_QUEUE);
-#endif
#ifdef MUTEX_WAKE_ALL
turnstile_broadcast(ts, TS_EXCLUSIVE_QUEUE);
_release_lock_quick(m);
@@ -637,46 +630,6 @@ _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line)
*/
turnstile_unpend(ts, TS_EXCLUSIVE_LOCK);
turnstile_chain_unlock(&m->lock_object);
-
-#ifndef PREEMPTION
- /*
- * XXX: This is just a hack until preemption is done. However,
- * once preemption is done we need to either wrap the
- * turnstile_signal() and release of the actual lock in an
- * extra critical section or change the preemption code to
- * always just set a flag and never do instant-preempts.
- */
- td = curthread;
- if (td->td_critnest > 0 || td1->td_priority >= td->td_priority)
- return;
-
- thread_lock(td1);
- if (!TD_IS_RUNNING(td1)) {
-#ifdef notyet
- if (td->td_ithd != NULL) {
- struct ithd *it = td->td_ithd;
-
- if (it->it_interrupted) {
- if (LOCK_LOG_TEST(&m->lock_object, opts))
- CTR2(KTR_LOCK,
- "_mtx_unlock_sleep: %p interrupted %p",
- it, it->it_interrupted);
- intr_thd_fixup(it);
- }
- }
-#endif
- if (LOCK_LOG_TEST(&m->lock_object, opts))
- CTR2(KTR_LOCK,
- "_mtx_unlock_sleep: %p switching out lock=%p", m,
- (void *)m->mtx_lock);
-
- mi_switch(SW_INVOL, NULL);
- if (LOCK_LOG_TEST(&m->lock_object, opts))
- CTR2(KTR_LOCK, "_mtx_unlock_sleep: %p resuming lock=%p",
- m, (void *)m->mtx_lock);
- }
- thread_unlock(td1);
-#endif
}
/*
OpenPOWER on IntegriCloud