Author: jhb
Date: Fri Feb  4 14:16:41 2011
New Revision: 218272
URL: http://svn.freebsd.org/changeset/base/218272

Log:
  Always assert that the turnstile chain lock is held in turnstile_wait()
  and remove a duplicate hash lookup.
  
  MFC after:    1 week

Modified:
  head/sys/kern/subr_turnstile.c

Modified: head/sys/kern/subr_turnstile.c
==============================================================================
--- head/sys/kern/subr_turnstile.c      Fri Feb  4 14:13:15 2011        
(r218271)
+++ head/sys/kern/subr_turnstile.c      Fri Feb  4 14:16:41 2011        
(r218272)
@@ -685,8 +685,8 @@ turnstile_wait(struct turnstile *ts, str
         * turnstile already in use by this lock.
         */
        tc = TC_LOOKUP(ts->ts_lockobj);
+       mtx_assert(&tc->tc_lock, MA_OWNED);
        if (ts == td->td_turnstile) {
-               mtx_assert(&tc->tc_lock, MA_OWNED);
 #ifdef TURNSTILE_PROFILING
                tc->tc_depth++;
                if (tc->tc_depth > tc->tc_max_depth) {
@@ -695,7 +695,6 @@ turnstile_wait(struct turnstile *ts, str
                                turnstile_max_depth = tc->tc_max_depth;
                }
 #endif
-               tc = TC_LOOKUP(ts->ts_lockobj);
                LIST_INSERT_HEAD(&tc->tc_turnstiles, ts, ts_hash);
                KASSERT(TAILQ_EMPTY(&ts->ts_pending),
                    ("thread's turnstile has pending threads"));
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to