From owner-freebsd-arch Tue Mar 5 7:54:56 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by hub.freebsd.org (Postfix) with ESMTP id 0B5FF37B43A for ; Tue, 5 Mar 2002 07:52:33 -0800 (PST) Received: (qmail 14540 invoked from network); 5 Mar 2002 15:52:25 -0000 Received: from unknown (HELO server.baldwin.cx) ([65.91.137.49]) (envelope-sender ) by mail5.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 5 Mar 2002 15:52:26 -0000 Received: from laptop.baldwin.cx (john@laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g25Fq5G57146; Tue, 5 Mar 2002 10:52:05 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20020305223033.M4715-100000@gamplex.bde.org> Date: Tue, 05 Mar 2002 10:51:52 -0500 (EST) From: John Baldwin To: Bruce Evans Subject: Re: kernel process priority question... Cc: arch@FreeBSD.ORG, Poul-Henning Kamp 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 05-Mar-02 Bruce Evans wrote: > 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. Yes, the priority stuff is still rather a mess in the wake of KSE right now. For example, resetpriority() and updatepri() try to mix updating per-KSE group prioritites (user priorities) with the priority of the current thread. Cleaning all this up is teh biggest thing the preemption code is waiting on (aside from all the preemption bugs :) > Bruce -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message