From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 29 17:26:20 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EBF51065695 for ; Mon, 29 Sep 2008 17:26:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id C6E1D8FC13 for ; Mon, 29 Sep 2008 17:26:19 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m8THQDDX046325; Mon, 29 Sep 2008 13:26:13 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 29 Sep 2008 12:02:57 -0400 User-Agent: KMail/1.9.7 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200809291202.57731.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 29 Sep 2008 13:26:13 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/8353/Mon Sep 29 05:57:09 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: "Murty, Ravi" Subject: Re: priority fields in a thread X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Sep 2008 17:26:20 -0000 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