Subject: Re: sched_changepri
To: None <>
From: YAMAMOTO Takashi <>
List: tech-kern
Date: 02/25/2007 23:51:22
> (YAMAMOTO Takashi) wrote:
> > - why doesn't sched_changepri() change l_priority if it was < PUSER? 
> Priorities which is less than PUSER priority are used only for a system LWPs.
> Normally, sched_changepri() is used for user LWPs (Andrew will correct me, if
> I am wrong).

it's used for kernel lwps as well.

> Please note, that soon priority model is going to change a little bit.

can you explain?

> > 	- uvm_scheduler does:
> > 		l = curlwp;
> > 		lwp_lock(l);
> > 		lwp_changepri(l, PVM);
> > 		lwp_unlock(l);
> This one will change the position in runqueue and does the check for
> reschedulling (it will preempt if priority is higher than curlwp).
> The second one is only an update of the number. One should manually need
> to do (dequeue and) enqueue and/or checking for recheduling.
> Hence, it depends on the needs. Both could be used normally, since priorities
> are (and will be) the scheduler-independent part.

yes, i know they are the same for onproc lwps.
as ad@ wrote both of them, i wonder why he did them in these different ways.

> By the way, I am not sure why there are two variants for changing the
> priority: sched_changepri() and lwp_changepri(). Andrew?

lwp_changepri() calls sched_changepri() via syncobj_t.
sched_changepri() is something which you shouldn't use directly in most cases.