svn commit: r228207 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Fri Dec 2 20:08:17 UTC 2011
On 12/2/11 2:59 PM, John Baldwin wrote:
> Author: jhb
> Date: Fri Dec 2 19:59:46 2011
> New Revision: 228207
> URL: http://svn.freebsd.org/changeset/base/228207
>
> Log:
> When changing the user priority of a thread, change the real priority
> in addition to the user priority for threads whose current real priority
> is equal to the previous user priority or if the new priority is a
> real-time priority. This allows priority changes of other threads to
> have an immediate effect.
An example that this fixes is suppose you have a CPU bound thread
running on an dedicated CPU with rtprio and now want to run another
quick thread on that CPU. The quick thread doesn't have rtprio and
won't get a chance to run (by design). You want to fix this though so
you lower the CPU bound thread to a lower rtprio and set the quick
thread to rtprio 0. Without this fix the quick thread still won't get
to run as the rtprio 0 will never take effect until the thread returns
from userland. With this change it will now take effect immediately so
the quick thread will preempt the CPU bound one.
You can test this by scheduling two CPU bound rtprio threads on a single
CPU (I used jot ${BIGNUM} >/dev/null) and frob the two processes
relative realtime priorities. Before whatever jot started running first
would never be preempted by the second jot, even if the second jot was
assigned a higher RT priority. Now the the jot process with the highest
RT priority always runs.
--
John Baldwin
More information about the svn-src-all
mailing list