cvs commit: src/sys/kern subr_sleepqueue.c
John Baldwin
jhb at FreeBSD.org
Fri Nov 5 20:19:58 GMT 2004
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
More information about the cvs-src
mailing list