path: root/sys/sys/rtprio.h
diff options
authorJake Burkholder <jake@FreeBSD.org>2001-02-12 00:20:08 +0000
committerJake Burkholder <jake@FreeBSD.org>2001-02-12 00:20:08 +0000
commitd5a08a6065a153f519dc5ada150c981d37f91345 (patch)
tree22feb65a2c5c3166f680bb7f0e4b1a6798b976c7 /sys/sys/rtprio.h
parent216a89d6a40093f3db32638d4b73d9b72816823c (diff)
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: svn path=/head/; revision=72376
Diffstat (limited to 'sys/sys/rtprio.h')
1 files changed, 16 insertions, 29 deletions
diff --git a/sys/sys/rtprio.h b/sys/sys/rtprio.h
index 578afc515f63..ad107603c39d 100644
--- a/sys/sys/rtprio.h
+++ b/sys/sys/rtprio.h
@@ -34,25 +34,26 @@
#ifndef _SYS_RTPRIO_H_
#define _SYS_RTPRIO_H_
+#include <sys/priority.h>
* Process realtime-priority specifications to rtprio.
/* priority types. Start at 1 to catch uninitialized fields. */
-#define RTP_PRIO_ITHREAD 1 /* interrupt thread */
-#define RTP_PRIO_REALTIME 2 /* real time process */
-#define RTP_PRIO_NORMAL 3 /* time sharing process */
-#define RTP_PRIO_IDLE 4 /* idle process */
+#define RTP_PRIO_REALTIME PRI_REALTIME /* real time process */
+#define RTP_PRIO_NORMAL PRI_TIMESHARE /* time sharing process */
+#define RTP_PRIO_IDLE PRI_IDLE /* idle process */
-#define RTP_PRIO_FIFO_BIT 4
/* priority range */
#define RTP_PRIO_MIN 0 /* Highest priority */
@@ -66,32 +67,18 @@
#ifndef LOCORE
- * Scheduling class information. This is strictly speaking not only
- * for real-time processes. We should replace it with two variables:
- * class and priority. At the moment we use prio here for real-time
- * and interrupt processes, and for others we use proc.p_pri. FIXME.
+ * Scheduling class information.
struct rtprio {
u_short type; /* scheduling class */
u_short prio;
- * Interrupt thread priorities, after BSD/OS.
- */
-#define PI_REALTIME 1 /* very high priority (clock) */
-#define PI_AV 2 /* Audio/video devices */
-#define PI_TTYHIGH 3 /* High priority tty's (small FIFOs) */
-#define PI_TAPE 4 /* Tape devices (high for streaming) */
-#define PI_NET 5 /* Network interfaces */
-#define PI_DISK 6 /* Disks and SCSI */
-#define PI_TTYLOW 7 /* Ttys with big buffers */
-#define PI_DISKLOW 8 /* Disks that do programmed I/O */
-#define PI_DULL 9 /* We don't know or care */
-/* Soft interrupt threads */
-#define PI_SOFT 15 /* All soft interrupts */
+#ifdef _KERNEL
+int rtp_to_pri(struct rtprio *, struct priority *);
+void pri_to_rtp(struct priority *, struct rtprio *);
#ifndef _KERNEL
#include <sys/cdefs.h>