Date: Tue, 5 Mar 2002 23:24:10 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Poul-Henning Kamp <phk@FreeBSD.ORG> Cc: <arch@FreeBSD.ORG> Subject: Re: kernel process priority question... Message-ID: <20020305223033.M4715-100000@gamplex.bde.org> In-Reply-To: <17280.1015281145@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020305223033.M4715-100000>
