summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2004-12-30 20:29:58 +0000
committerjhb <jhb@FreeBSD.org>2004-12-30 20:29:58 +0000
commit7b611b0cb22347b6dcb39cb97b7826908f188d10 (patch)
tree3db78404a3bf8319128dcd14795f6b1149c927aa
parent5624553de421f01520096aaaedc63434e38c8e31 (diff)
downloadFreeBSD-src-7b611b0cb22347b6dcb39cb97b7826908f188d10.zip
FreeBSD-src-7b611b0cb22347b6dcb39cb97b7826908f188d10.tar.gz
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.
-rw-r--r--sys/compat/ndis/subr_hal.c2
-rw-r--r--sys/dev/md/md.c5
-rw-r--r--sys/geom/geom_kern.c15
-rw-r--r--sys/geom/mirror/g_mirror.c5
-rw-r--r--sys/geom/raid3/g_raid3.c5
-rw-r--r--sys/kern/kern_intr.c7
-rw-r--r--sys/kern/kern_resource.c1
-rw-r--r--sys/kern/kern_synch.c2
8 files changed, 26 insertions, 16 deletions
diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c
index 42cea66..d9224a9 100644
--- a/sys/compat/ndis/subr_hal.c
+++ b/sys/compat/ndis/subr_hal.c
@@ -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);
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 8c35d85..550fd5f 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -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:
diff --git a/sys/geom/geom_kern.c b/sys/geom/geom_kern.c
index 762a1fd..6e6b301 100644
--- a/sys/geom/geom_kern.c
+++ b/sys/geom/geom_kern.c
@@ -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);
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index 7725722..b10467d 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -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 (;;) {
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c
index 5dbf94b..939eeb3 100644
--- a/sys/geom/raid3/g_raid3.c
+++ b/sys/geom/raid3/g_raid3.c
@@ -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 (;;) {
diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c
index 936cc30..6f22daa 100644
--- a/sys/kern/kern_intr.c
+++ b/sys/kern/kern_intr.c
@@ -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) {
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
index d9e25c8..7368cbd 100644
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -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);
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index bd28c1d..3f5689a 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -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);
OpenPOWER on IntegriCloud