svn commit: r305368 - head/sys/kern
Mark Johnston
markj at FreeBSD.org
Sun Sep 4 00:29:50 UTC 2016
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);
More information about the svn-src-head
mailing list