Page MenuHomeFreeBSD

Check for preemption after lowering a thread's priority

Authored by rstone on Feb 9 2017, 5:53 PM.



When a high-priority thread is waiting for a mutex held by a
low-priority thread, it temporarily lends its priority to the
low-priority thread to prevent priority inversion. When the mutex
is released, the lent priority is revoked and the low-priority
thread goes back to its original priority.

When the priority of that thread is lowered (through a call to
sched_priority()), the schedule was not checking whether
there is now a high-priority thread in the run queue. This can
cause threads with real-time priority to be starved in the run
queue while the low-priority thread finishes its quantum.

Fix this by explicitly checking whether preemption is necessary
when a thread's priority is lowered.

Sponsored by: Dell EMC Isilon

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

rstone updated this revision to Diff 24940.Feb 9 2017, 5:53 PM
rstone retitled this revision from to Check for preemption after lowering a thread's priority.
rstone edited the test plan for this revision. (Show Details)
rstone updated this object.
rstone added a comment.Feb 9 2017, 5:57 PM
This comment was removed by rstone.
emaste added a subscriber: emaste.Feb 9 2017, 7:00 PM
avg added a subscriber: avg.Feb 9 2017, 8:31 PM
This revision was automatically updated to reflect the committed changes.