svn commit: r354404 - stable/11/sys/kern
Alexander Motin
mav at FreeBSD.org
Wed Nov 6 17:59:19 UTC 2019
Author: mav
Date: Wed Nov 6 17:59:18 2019
New Revision: 354404
URL: https://svnweb.freebsd.org/changeset/base/354404
Log:
MFC r305368 (by markj): Micro-optimize sleepq_signal().
Lift a comparison out of the loop that finds the highest-priority thread
on the queue.
Modified:
stable/11/sys/kern/subr_sleepqueue.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/kern/subr_sleepqueue.c
==============================================================================
--- stable/11/sys/kern/subr_sleepqueue.c Wed Nov 6 17:49:38 2019 (r354403)
+++ stable/11/sys/kern/subr_sleepqueue.c Wed Nov 6 17:59:18 2019 (r354404)
@@ -909,9 +909,9 @@ sleepq_signal(void *wchan, int flags, int pri, int que
* 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-stable-11
mailing list