summaryrefslogtreecommitdiffstats
path: root/sys/posix4
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2001-02-12 00:20:08 +0000
committerjake <jake@FreeBSD.org>2001-02-12 00:20:08 +0000
commit55d5108ac58bdc48fbd9eccefcb58a49682107b5 (patch)
tree2e0de19f9802474be1018e6086f4bb4e01fed0be /sys/posix4
parent3acecaf2d523e3763f225a429b3007ff059b4253 (diff)
downloadFreeBSD-src-55d5108ac58bdc48fbd9eccefcb58a49682107b5.zip
FreeBSD-src-55d5108ac58bdc48fbd9eccefcb58a49682107b5.tar.gz
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.
Diffstat (limited to 'sys/posix4')
-rw-r--r--sys/posix4/ksched.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/posix4/ksched.c b/sys/posix4/ksched.c
index 0c1fb72..27a0899 100644
--- a/sys/posix4/ksched.c
+++ b/sys/posix4/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.
OpenPOWER on IntegriCloud