Micro-optimize sleepq_signal().

Lift a comparison out of the loop that finds the highest-priority thread
on the queue.

MFC after:	1 week
This commit is contained in:
Mark Johnston 2016-09-04 00:29:48 +00:00
parent dd9cb6da0b
commit 3da0f3c9ae

View File

@ -861,9 +861,9 @@ sleepq_signal(void *wchan, int flags, int pri, int queue)
* 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);