From owner-svn-src-all@FreeBSD.ORG Wed Jul 14 19:00:45 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B9E51065675; Wed, 14 Jul 2010 19:00:45 +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 EEB808FC0A; Wed, 14 Jul 2010 19:00:44 +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 o6EJ0i9T052317; Wed, 14 Jul 2010 19:00:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6EJ0igJ052314; Wed, 14 Jul 2010 19:00:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201007141900.o6EJ0igJ052314@svn.freebsd.org> From: John Baldwin Date: Wed, 14 Jul 2010 19:00:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210072 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2010 19:00:45 -0000 Author: jhb Date: Wed Jul 14 19:00:44 2010 New Revision: 210072 URL: http://svn.freebsd.org/changeset/base/210072 Log: MFC 208787: Assert that the thread lock is held in sched_pctcpu() instead of recursively acquiring it. All of the current callers already hold the lock. Modified: stable/8/sys/kern/sched_4bsd.c stable/8/sys/kern/sched_ule.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/sched_4bsd.c ============================================================================== --- stable/8/sys/kern/sched_4bsd.c Wed Jul 14 18:55:45 2010 (r210071) +++ stable/8/sys/kern/sched_4bsd.c Wed Jul 14 19:00:44 2010 (r210072) @@ -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: stable/8/sys/kern/sched_ule.c ============================================================================== --- stable/8/sys/kern/sched_ule.c Wed Jul 14 18:55:45 2010 (r210071) +++ stable/8/sys/kern/sched_ule.c Wed Jul 14 19:00:44 2010 (r210072) @@ -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); }