diff options
author | phk <phk@FreeBSD.org> | 2006-11-30 08:27:38 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2006-11-30 08:27:38 +0000 |
commit | b911f6e6f0bc5628a07e488e14a3453deb7cb04c (patch) | |
tree | fae9d5959d234e0ec9cf132cf65ede00bc67f838 /sys/kern/kern_synch.c | |
parent | fe73aced48b32c46fb350b4abf167f5507f52b93 (diff) | |
download | FreeBSD-src-b911f6e6f0bc5628a07e488e14a3453deb7cb04c.zip FreeBSD-src-b911f6e6f0bc5628a07e488e14a3453deb7cb04c.tar.gz |
Only grab the sched_lock if we actually need to modify the thread priority.
During a buildworld only 2/3 of the calls to msleep actually changed
the priority.
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 3662902..818d7e3 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -124,7 +124,7 @@ msleep(ident, mtx, priority, wmesg, timo) { struct thread *td; struct proc *p; - int catch, rval, flags; + int catch, rval, flags, pri; WITNESS_SAVE_DECL(mtx); td = curthread; @@ -194,11 +194,12 @@ msleep(ident, mtx, priority, wmesg, timo) sleepq_set_timeout(ident, timo); /* - * Adjust this thread's priority. + * Adjust this thread's priority, if necessary. */ - if ((priority & PRIMASK) != 0) { + pri = priority & PRIMASK; + if (pri != 0 && pri != td->td_priority) { mtx_lock_spin(&sched_lock); - sched_prio(td, priority & PRIMASK); + sched_prio(td, pri); mtx_unlock_spin(&sched_lock); } |