Date: Sun, 4 Sep 2016 00:29:49 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305368 - head/sys/kern Message-ID: <201609040029.u840Tn5D019584@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609040029.u840Tn5D019584>