Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Sep 2008 12:02:57 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        "Murty, Ravi" <ravi.murty@intel.com>
Subject:   Re: priority fields in a thread
Message-ID:  <200809291202.57731.jhb@freebsd.org>
In-Reply-To: <AEBCFC23C0E40949B10BA2C224FC61B00874536D@orsmsx416.amr.corp.intel.com>
References:  <AEBCFC23C0E40949B10BA2C224FC61B00874536D@orsmsx416.amr.corp.intel.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 26 September 2008 07:15:48 pm Murty, Ravi wrote:
> Hello,
> 
> I was wondering what all these different priority related fields in a
> thread structure meant. This is the 8.0 kernel tree.
> 
> Td_base_pri

What the thread's priority should be while it is in the kernel.  Doing a 
*sleep(..., PFOO) sets this to PFOO.  On return to userland it gets set back 
to td_user_pri.  The purpose of this field is to hold the "real" priority of 
a thread and is used when undoing the effects of priority propagation.

> Td_user_pri

This is the user priority of the thread.  This is always >= PZERO for normal 
processes (real-time processes are different, though).  When exiting the 
kernel, any priority "boost" from *sleep() is given up by dropping the 
priority back to this value.

> Td_base_user_pri

This is like td_base_pri in that it is a saved copy of the "real" userland 
priority of a thread.  The umtx locks now support a userland version of 
priority propagation and this field is used to restore the user priority of a 
thread when it drops the locks other user threads need.

> Td_priority

This is the actual priority of the thread right now.  When the thread is in 
userland, this should equal td_user_pri.  When the thread is in the kernel, 
this should equal td_base_pri except for when the thread has been lent 
another thread's priority because it holds a lock that other thread needs.

-- 
John Baldwin



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