diff options
author | jhb <jhb@FreeBSD.org> | 2010-06-03 16:02:11 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-06-03 16:02:11 +0000 |
commit | 16dab63fe9c4d2fdff7ae6a70fa1a08b5c4d0c31 (patch) | |
tree | f3f1d0931865dd13209e71768070231cccfedcba /sys/kern | |
parent | 7c23796624ecfbb8f63cd3692eb3effb34095139 (diff) | |
download | FreeBSD-src-16dab63fe9c4d2fdff7ae6a70fa1a08b5c4d0c31.zip FreeBSD-src-16dab63fe9c4d2fdff7ae6a70fa1a08b5c4d0c31.tar.gz |
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
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/sched_4bsd.c | 1 | ||||
-rw-r--r-- | sys/kern/sched_ule.c | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index b4098c8..2cdf2c4 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -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); } diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 274b2b1..ff17a26 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -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); } |