From owner-svn-src-head@FreeBSD.ORG Tue Nov 4 19:13:54 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DAAF1065679; Tue, 4 Nov 2008 19:13:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F01258FC20; Tue, 4 Nov 2008 19:13:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mA4JDrs7005315; Tue, 4 Nov 2008 19:13:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mA4JDrle005314; Tue, 4 Nov 2008 19:13:53 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200811041913.mA4JDrle005314@svn.freebsd.org> From: John Baldwin Date: Tue, 4 Nov 2008 19:13:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184653 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2008 19:13:54 -0000 Author: jhb Date: Tue Nov 4 19:13:53 2008 New Revision: 184653 URL: http://svn.freebsd.org/changeset/base/184653 Log: Don't bother calling setrunnable() and clearing the sleeping flag in sleepq_resume_thread() if the thread isn't asleep. Modified: head/sys/kern/subr_sleepqueue.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Tue Nov 4 19:04:01 2008 (r184652) +++ head/sys/kern/subr_sleepqueue.c Tue Nov 4 19:13:53 2008 (r184653) @@ -680,22 +680,25 @@ sleepq_resume_thread(struct sleepqueue * td->td_wchan = NULL; td->td_flags &= ~TDF_SINTR; - /* - * Note that thread td might not be sleeping if it is running - * sleepq_catch_signals() on another CPU or is blocked on - * its proc lock to check signals. It doesn't hurt to clear - * the sleeping flag if it isn't set though, so we just always - * do it. However, we can't assert that it is set. - */ CTR3(KTR_PROC, "sleepq_wakeup: thread %p (pid %ld, %s)", (void *)td, (long)td->td_proc->p_pid, td->td_name); - TD_CLR_SLEEPING(td); /* Adjust priority if requested. */ MPASS(pri == 0 || (pri >= PRI_MIN && pri <= PRI_MAX)); if (pri != 0 && td->td_priority > pri) sched_prio(td, pri); - return (setrunnable(td)); + + /* + * Note that thread td might not be sleeping if it is running + * sleepq_catch_signals() on another CPU or is blocked on its + * proc lock to check signals. There's no need to mark the + * thread runnable in that case. + */ + if (TD_IS_SLEEPING(td)) { + TD_CLR_SLEEPING(td); + return (setrunnable(td)); + } + return (0); } #ifdef INVARIANTS