From owner-freebsd-arch Tue Mar 5 4:26: 6 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id EC5B337B417; Tue, 5 Mar 2002 04:23:20 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id XAA24088; Tue, 5 Mar 2002 23:23:19 +1100 Date: Tue, 5 Mar 2002 23:24:10 +1100 (EST) From: Bruce Evans X-X-Sender: To: Poul-Henning Kamp Cc: Subject: Re: kernel process priority question... In-Reply-To: <17280.1015281145@critter.freebsd.dk> Message-ID: <20020305223033.M4715-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 4 Mar 2002, Poul-Henning Kamp wrote: > What is the correct way to set a priority on a kernel thread ? > > Is it legal to simply set the value like this: > > curthread->td_base_pri = PRIBIO; > > Or should the detour around the rtprio stuff be used: > > struct rtprio rtp; > > rtp.prio = RTP_PRIO_MAX; > rtp.type = RTP_PRIO_IDLE; > mtx_lock_spin(&sched_lock); > rtp_to_pri(&rtp, td->td_ksegrp); > mtx_unlock_spin(&sched_lock); Neither. The rtprio stuff should be just compatibility cruft to support the rtprio(2) mistake (extending {get,set}priority(2) would have been a smaller mistake, but even these were obsoleted by the POSIX.1-1993 about a year before rtprio(2) was committed). When setting priority fields directly, there are 4 of them in places that keep being moved by KSE changes, and the setting may need locking, so a function to hide the details would be useful. rtp_to_prio() is not that function. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message