svn commit: r210072 - stable/8/sys/kern
John Baldwin
jhb at FreeBSD.org
Wed Jul 14 19:00:45 UTC 2010
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);
}
More information about the svn-src-all
mailing list