Date: Fri, 5 Nov 2004 20:19:58 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/kern subr_sleepqueue.c Message-ID: <200411052019.iA5KJw7F027375@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
jhb 2004-11-05 20:19:58 UTC FreeBSD src repository Modified files: sys/kern subr_sleepqueue.c Log: - Store threads on sleep queues in FIFO order rather than sorted by priority. The sleep queues don't get updated when the priority of threads changes, so sleepq_signal() might not always wakeup the highest priority thread. Updating the queues when thread priorities change cannot be easily done due to lock orders, so instead we do an O(n) walk of the queue for a sleepq_signal() operation instead of O(1). On the other hand, adding a thread to a sleep queue now goes from O(n) to O(1) so it ends up as an even tradeoff. The correctness here with regards to priorities is actually fairly important. msleep() gives interactive threads their priority "boost" after they are placed on the queue, but before this fix that "boost" wasn't used to determine the highest priority thread that sleepq_signal() awoke. - Fix up some comments. Inspired by: ups, bde Revision Changes Path 1.14 +19 -16 src/sys/kern/subr_sleepqueue.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411052019.iA5KJw7F027375>