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.
This commit is contained in:
parent
9955cf96f6
commit
a4dcb4f627
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user