Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Mar 2002 10:51:52 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        arch@FreeBSD.ORG, Poul-Henning Kamp <phk@FreeBSD.ORG>
Subject:   Re: kernel process priority question...
Message-ID:  <XFMail.020305105152.jhb@FreeBSD.org>
In-Reply-To: <20020305223033.M4715-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <jhb@FreeBSD.org>  <><  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




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