PERFORCE change 100090 for review
Kip Macy
kmacy at FreeBSD.org
Mon Jun 26 20:55:16 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=100090
Change 100090 by kmacy at kmacy_storage:sun4v_work_sleepq on 2006/06/26 20:55:08
fix missing lock acquisitions of threads
Affected files ...
.. //depot/projects/kmacy_sun4v/src/sys/kern/subr_turnstile.c#8 edit
Differences ...
==== //depot/projects/kmacy_sun4v/src/sys/kern/subr_turnstile.c#8 (text+ko) ====
@@ -88,8 +88,7 @@
*/
#define TC_TABLESIZE 128 /* Must be power of 2. */
#define TC_MASK (TC_TABLESIZE - 1)
-#define TC_SHIFT 8
-#define TC_HASH(lock) (((uintptr_t)(lock) >> TC_SHIFT) & TC_MASK)
+#define TC_HASH(lock) ((lock)->lo_id & TC_MASK)
#define TC_LOOKUP(lock) &turnstile_chains[TC_HASH(lock)]
/*
@@ -837,7 +836,6 @@
*/
td = curthread;
pri = PRI_MAX;
- TD_SLOCK(td);
mtx_lock_spin(&td_contested_lock);
LIST_FOREACH(ts, &td->td_contested, ts_link) {
cp = turnstile_first_waiter(ts)->td_priority;
@@ -845,8 +843,10 @@
pri = cp;
}
mtx_unlock_spin(&td_contested_lock);
+ TD_SLOCK(td);
sched_unlend_prio(td, pri);
-
+ TD_SUNLOCK(td);
+
/*
* Wake up all the pending threads. If a thread is not blocked
* on a lock, then it is currently executing on another CPU in
@@ -866,14 +866,15 @@
#endif
TD_CLR_LOCK(td);
MPASS(TD_CAN_RUN(td));
+ TD_SLOCK(td);
setrunqueue(td, SRQ_BORING);
+ TD_SUNLOCK(td);
} else {
atomic_set_int(&td->td_flags, TDF_TSNOBLOCK);
MPASS(TD_IS_RUNNING(td) || TD_ON_RUNQ(td));
}
}
critical_exit();
- TD_SUNLOCK(td);
}
/*
More information about the p4-projects
mailing list