Author: markj
Date: Sun Sep  4 00:29:48 2016
New Revision: 305368
URL: https://svnweb.freebsd.org/changeset/base/305368

Log:
  Micro-optimize sleepq_signal().
  
  Lift a comparison out of the loop that finds the highest-priority thread
  on the queue.
  
  MFC after:    1 week

Modified:
  head/sys/kern/subr_sleepqueue.c

Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c     Sun Sep  4 00:25:49 2016        
(r305367)
+++ head/sys/kern/subr_sleepqueue.c     Sun Sep  4 00:29:48 2016        
(r305368)
@@ -861,9 +861,9 @@ sleepq_signal(void *wchan, int flags, in
         * been sleeping the longest since threads are always added to
         * the tail of sleep queues.
         */
-       besttd = NULL;
+       besttd = TAILQ_FIRST(&sq->sq_blocked[queue]);
        TAILQ_FOREACH(td, &sq->sq_blocked[queue], td_slpq) {
-               if (besttd == NULL || td->td_priority < besttd->td_priority)
+               if (td->td_priority < besttd->td_priority)
                        besttd = td;
        }
        MPASS(besttd != NULL);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to