Stop explicitly touching td_base_pri outside of the scheduler and simply

set a thread's priority via sched_prio() when that is the desired action.
The schedulers will start managing td_base_pri internally shortly.
This commit is contained in:
John Baldwin 2004-12-30 20:29:58 +00:00
parent 753d1af165
commit 63710c4d35
8 changed files with 26 additions and 16 deletions

View File

@ -308,7 +308,6 @@ hal_raise_irql(REGARGS1(uint8_t irql))
mtx_lock_spin(&sched_lock);
oldirql = curthread->td_base_pri;
sched_prio(curthread, PI_REALTIME);
curthread->td_base_pri = PI_REALTIME;
mtx_unlock_spin(&sched_lock);
return(oldirql);
@ -324,7 +323,6 @@ hal_lower_irql(REGARGS1(uint8_t oldirql))
panic("IRQL_NOT_GREATER_THAN");
mtx_lock_spin(&sched_lock);
curthread->td_base_pri = oldirql;
sched_prio(curthread, oldirql);
mtx_unlock_spin(&sched_lock);

View File

@ -71,6 +71,7 @@
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/sched.h>
#include <sys/sf_buf.h>
#include <sys/sysctl.h>
#include <sys/vnode.h>
@ -618,7 +619,9 @@ md_kthread(void *arg)
int error, hasgiant;
sc = arg;
curthread->td_base_pri = PRIBIO;
mtx_lock_spin(&sched_lock);
sched_prio(curthread, PRIBIO);
mtx_unlock_spin(&sched_lock);
switch (sc->type) {
case MD_VNODE:

View File

@ -47,8 +47,9 @@ __FBSDID("$FreeBSD$");
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sx.h>
#include <sys/sbuf.h>
#include <sys/sched.h>
#include <sys/sx.h>
#include <geom/geom.h>
#include <geom/geom_int.h>
@ -87,7 +88,9 @@ g_up_procbody(void)
struct thread *tp = FIRST_THREAD_IN_PROC(p);
mtx_assert(&Giant, MA_NOTOWNED);
tp->td_base_pri = PRIBIO;
mtx_lock_spin(&sched_lock);
sched_prio(tp, PRIBIO);
mtx_unlock_spin(&sched_lock);
for(;;) {
g_io_schedule_up(tp);
}
@ -108,7 +111,9 @@ g_down_procbody(void)
struct thread *tp = FIRST_THREAD_IN_PROC(p);
mtx_assert(&Giant, MA_NOTOWNED);
tp->td_base_pri = PRIBIO;
mtx_lock_spin(&sched_lock);
sched_prio(tp, PRIBIO);
mtx_unlock_spin(&sched_lock);
for(;;) {
g_io_schedule_down(tp);
}
@ -129,7 +134,9 @@ g_event_procbody(void)
struct thread *tp = FIRST_THREAD_IN_PROC(p);
mtx_assert(&Giant, MA_NOTOWNED);
tp->td_base_pri = PRIBIO;
mtx_lock_spin(&sched_lock);
sched_prio(tp, PRIBIO);
mtx_unlock_spin(&sched_lock);
for(;;) {
g_run_events();
tsleep(&g_wait_event, PRIBIO, "-", hz/10);

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <geom/geom.h>
#include <sys/proc.h>
#include <sys/kthread.h>
#include <sys/sched.h>
#include <geom/mirror/g_mirror.h>
@ -1478,7 +1479,9 @@ g_mirror_worker(void *arg)
u_int nreqs;
sc = arg;
curthread->td_base_pri = PRIBIO;
mtx_lock_spin(&sched_lock);
sched_prio(curthread, PRIBIO);
mtx_unlock_spin(&sched_lock);
nreqs = 0;
for (;;) {

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <geom/geom.h>
#include <sys/proc.h>
#include <sys/kthread.h>
#include <sys/sched.h>
#include <geom/raid3/g_raid3.h>
@ -1729,7 +1730,9 @@ g_raid3_worker(void *arg)
u_int nreqs;
sc = arg;
curthread->td_base_pri = PRIBIO;
mtx_lock_spin(&sched_lock);
sched_prio(curthread, PRIBIO);
mtx_unlock_spin(&sched_lock);
nreqs = 0;
for (;;) {

View File

@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/random.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
#include <sys/sysctl.h>
#include <sys/unistd.h>
#include <sys/vmmeter.h>
@ -143,14 +144,12 @@ ithread_update(struct ithd *ithd)
ih = TAILQ_FIRST(&ithd->it_handlers);
if (ih == NULL) {
mtx_lock_spin(&sched_lock);
td->td_priority = PRI_MAX_ITHD;
td->td_base_pri = PRI_MAX_ITHD;
sched_prio(td, PRI_MAX_ITHD);
mtx_unlock_spin(&sched_lock);
return;
}
mtx_lock_spin(&sched_lock);
td->td_priority = ih->ih_pri;
td->td_base_pri = ih->ih_pri;
sched_prio(td, ih->ih_pri);
mtx_unlock_spin(&sched_lock);
missed = 0;
TAILQ_FOREACH(ih, &ithd->it_handlers, ih_next) {

View File

@ -423,7 +423,6 @@ rtp_to_pri(struct rtprio *rtp, struct ksegrp *kg)
}
sched_class(kg, rtp->type);
if (curthread->td_ksegrp == kg) {
curthread->td_base_pri = kg->kg_user_pri;
sched_prio(curthread, kg->kg_user_pri); /* XXX dubious */
}
return (0);

View File

@ -212,8 +212,6 @@ msleep(ident, mtx, priority, wmesg, timo)
/*
* Adjust this thread's priority.
*
* XXX: do we need to save priority in td_base_pri?
*/
mtx_lock_spin(&sched_lock);
sched_prio(td, priority & PRIMASK);