Subject: Re: sched_changepri
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Mindaugas R. <rmind@NetBSD.org>
List: tech-kern
Date: 02/25/2007 16:23:01
yamt@mwd.biglobe.ne.jp (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).
Please note, that soon priority model is going to change a little bit.

> 	- 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.

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

-- 
Best regards,
Mindaugas
www.NetBSD.org