From owner-cvs-all@FreeBSD.ORG Fri Nov 5 20:19:58 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7EC3016A4CE; Fri, 5 Nov 2004 20:19:58 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 71D6743D48; Fri, 5 Nov 2004 20:19:58 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id iA5KJwuD027376; Fri, 5 Nov 2004 20:19:58 GMT (envelope-from jhb@repoman.freebsd.org) Received: (from jhb@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id iA5KJw7F027375; Fri, 5 Nov 2004 20:19:58 GMT (envelope-from jhb) Message-Id: <200411052019.iA5KJw7F027375@repoman.freebsd.org> From: John Baldwin Date: Fri, 5 Nov 2004 20:19:58 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/kern subr_sleepqueue.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Nov 2004 20:19:58 -0000 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