From owner-svn-src-head@FreeBSD.ORG Thu Jun 3 16:02:12 2010 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 2F67C106564A; Thu, 3 Jun 2010 16:02:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F1548FC1E; Thu, 3 Jun 2010 16:02:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o53G2C6A025505; Thu, 3 Jun 2010 16:02:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o53G2BBO025502; Thu, 3 Jun 2010 16:02:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201006031602.o53G2BBO025502@svn.freebsd.org> From: John Baldwin Date: Thu, 3 Jun 2010 16:02:11 +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: r208787 - 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: Thu, 03 Jun 2010 16:02:12 -0000 Author: jhb Date: Thu Jun 3 16:02:11 2010 New Revision: 208787 URL: http://svn.freebsd.org/changeset/base/208787 Log: Assert that the thread lock is held in sched_pctcpu() instead of recursively acquiring it. All of the current callers already hold the lock. MFC after: 1 month Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Thu Jun 3 14:51:29 2010 (r208786) +++ head/sys/kern/sched_4bsd.c Thu Jun 3 16:02:11 2010 (r208787) @@ -1523,6 +1523,7 @@ sched_pctcpu(struct thread *td) { struct td_sched *ts; + THREAD_LOCK_ASSERT(td, MA_OWNED); ts = td->td_sched; return (ts->ts_pctcpu); } Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Thu Jun 3 14:51:29 2010 (r208786) +++ head/sys/kern/sched_ule.c Thu Jun 3 16:02:11 2010 (r208787) @@ -2367,7 +2367,7 @@ sched_pctcpu(struct thread *td) if (ts == NULL) return (0); - thread_lock(td); + THREAD_LOCK_ASSERT(td, MA_OWNED); if (ts->ts_ticks) { int rtick; @@ -2376,7 +2376,6 @@ sched_pctcpu(struct thread *td) rtick = min(SCHED_TICK_HZ(ts) / SCHED_TICK_SECS, hz); pctcpu = (FSCALE * ((FSCALE * rtick)/hz)) >> FSHIFT; } - thread_unlock(td); return (pctcpu); }