diff options
author | Jake Burkholder <jake@FreeBSD.org> | 2001-02-12 00:20:08 +0000 |
---|---|---|
committer | Jake Burkholder <jake@FreeBSD.org> | 2001-02-12 00:20:08 +0000 |
commit | d5a08a6065a153f519dc5ada150c981d37f91345 (patch) | |
tree | 22feb65a2c5c3166f680bb7f0e4b1a6798b976c7 /sys/kern/ksched.c | |
parent | 216a89d6a40093f3db32638d4b73d9b72816823c (diff) | |
download | src-d5a08a6065a153f519dc5ada150c981d37f91345.tar.gz src-d5a08a6065a153f519dc5ada150c981d37f91345.zip |
Implement a unified run queue and adjust priority levels accordingly.
- All processes go into the same array of queues, with different
scheduling classes using different portions of the array. This
allows user processes to have their priorities propogated up into
interrupt thread range if need be.
- I chose 64 run queues as an arbitrary number that is greater than
32. We used to have 4 separate arrays of 32 queues each, so this
may not be optimal. The new run queue code was written with this
in mind; changing the number of run queues only requires changing
constants in runq.h and adjusting the priority levels.
- The new run queue code takes the run queue as a parameter. This
is intended to be used to create per-cpu run queues. Implement
wrappers for compatibility with the old interface which pass in
the global run queue structure.
- Group the priority level, user priority, native priority (before
propogation) and the scheduling class into a struct priority.
- Change any hard coded priority levels that I found to use
symbolic constants (TTIPRI and TTOPRI).
- Remove the curpriority global variable and use that of curproc.
This was used to detect when a process' priority had lowered and
it should yield. We now effectively yield on every interrupt.
- Activate propogate_priority(). It should now have the desired
effect without needing to also propogate the scheduling class.
- Temporarily comment out the call to vm_page_zero_idle() in the
idle loop. It interfered with propogate_priority() because
the idle process needed to do a non-blocking acquire of Giant
and then other processes would try to propogate their priority
onto it. The idle process should not do anything except idle.
vm_page_zero_idle() will return in the form of an idle priority
kernel thread which is woken up at apprioriate times by the vm
system.
- Update struct kinfo_proc to the new priority interface. Deliberately
change its size by adjusting the spare fields. It remained the same
size, but the layout has changed, so userland processes that use it
would parse the data incorrectly. The size constraint should really
be changed to an arbitrary version number. Also add a debug.sizeof
sysctl node for struct kinfo_proc.
Notes
Notes:
svn path=/head/; revision=72376
Diffstat (limited to 'sys/kern/ksched.c')
-rw-r--r-- | sys/kern/ksched.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/kern/ksched.c b/sys/kern/ksched.c index 0c1fb72dd3a5..27a0899b44a6 100644 --- a/sys/kern/ksched.c +++ b/sys/kern/ksched.c @@ -96,9 +96,11 @@ int ksched_detach(struct ksched *p) static __inline int getscheduler(register_t *ret, struct ksched *ksched, struct proc *p) { + struct rtprio rtp; int e = 0; - switch (p->p_rtprio.type) + pri_to_rtp(&p->p_pri, &rtp); + switch (rtp.type) { case RTP_PRIO_FIFO: *ret = SCHED_FIFO; @@ -138,8 +140,11 @@ int ksched_setparam(register_t *ret, struct ksched *ksched, int ksched_getparam(register_t *ret, struct ksched *ksched, struct proc *p, struct sched_param *param) { - if (RTP_PRIO_IS_REALTIME(p->p_rtprio.type)) - param->sched_priority = rtpprio_to_p4prio(p->p_rtprio.prio); + struct rtprio rtp; + + pri_to_rtp(&p->p_pri, &rtp); + if (RTP_PRIO_IS_REALTIME(rtp.type)) + param->sched_priority = rtpprio_to_p4prio(rtp.prio); return 0; } @@ -169,7 +174,7 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched, rtp.type = (policy == SCHED_FIFO) ? RTP_PRIO_FIFO : RTP_PRIO_REALTIME; - p->p_rtprio = rtp; + rtp_to_pri(&rtp, &p->p_pri); need_resched(); } else @@ -182,7 +187,7 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched, { rtp.type = RTP_PRIO_NORMAL; rtp.prio = p4prio_to_rtpprio(param->sched_priority); - p->p_rtprio = rtp; + rtp_to_pri(&rtp, &p->p_pri); /* XXX Simply revert to whatever we had for last * normal scheduler priorities. |