Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Dec 2011 15:08:16 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r228207 - head/sys/kern
Message-ID:  <4ED93030.6000203@FreeBSD.org>
In-Reply-To: <201112021959.pB2Jxka6006739@svn.freebsd.org>
References:  <201112021959.pB2Jxka6006739@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ED93030.6000203>