diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_mib.c | 9 | ||||
-rw-r--r-- | sys/kern/kern_resource.c | 7 | ||||
-rw-r--r-- | sys/kern/kern_synch.c | 42 |
3 files changed, 44 insertions, 14 deletions
diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index ad93402..9718f6b 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $Id: kern_mib.c,v 1.12 1997/10/19 18:45:59 davidg Exp $ + * $Id: kern_mib.c,v 1.13 1997/12/25 13:14:21 gpalmer Exp $ */ #include <sys/param.h> @@ -52,6 +52,8 @@ #include <machine/smp.h> #endif +#include "opt_posix4.h" + SYSCTL_NODE(, 0, sysctl, CTLFLAG_RW, 0, "Sysctl internal magic"); SYSCTL_NODE(, CTL_KERN, kern, CTLFLAG_RW, 0, @@ -71,6 +73,11 @@ SYSCTL_NODE(, CTL_MACHDEP, machdep, CTLFLAG_RW, 0, SYSCTL_NODE(, CTL_USER, user, CTLFLAG_RW, 0, "user-level"); +#ifdef POSIX4 +SYSCTL_NODE(, CTL_POSIX4, posix4, CTLFLAG_RW, 0, + "posix4, (see posix4.h)"); +#endif + SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD, osrelease, 0, ""); SYSCTL_INT(_kern, KERN_OSREV, osrevision, CTLFLAG_RD, 0, BSD, ""); diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 02c288e..1b034ca 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_resource.c 8.5 (Berkeley) 1/21/94 - * $Id: kern_resource.c,v 1.31 1998/02/04 18:43:10 dg Exp $ + * $Id: kern_resource.c,v 1.32 1998/02/09 06:09:24 eivind Exp $ */ #include "opt_compat.h" @@ -266,12 +266,15 @@ rtprio(curp, uap) * due to a CPU-bound normal process). Fix me! XXX */ #if 0 - if (rtp.type == RTP_PRIO_REALTIME) + if (RTP_PRIO_IS_REALTIME(rtp.type)) #endif if (rtp.type != RTP_PRIO_NORMAL) return (EPERM); } switch (rtp.type) { +#ifdef RTP_PRIO_FIFO + case RTP_PRIO_FIFO: +#endif case RTP_PRIO_REALTIME: case RTP_PRIO_NORMAL: case RTP_PRIO_IDLE: diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index a434df8..bb370ac 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 - * $Id: kern_synch.c,v 1.46 1998/02/06 12:13:25 eivind Exp $ + * $Id: kern_synch.c,v 1.47 1998/02/25 06:04:46 bde Exp $ */ #include "opt_ktrace.h" @@ -96,6 +96,26 @@ sysctl_kern_quantum SYSCTL_HANDLER_ARGS SYSCTL_PROC(_kern, OID_AUTO, quantum, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof quantum, sysctl_kern_quantum, "I", ""); +/* maybe_resched: Decide if you need to reschedule or not + * taking the priorities and schedulers into account. + */ +static void maybe_resched(struct proc *chk) +{ + struct proc *p = curproc; /* XXX */ + + if (p == 0 || + ((chk->p_priority < curpriority) && + ((RTP_PRIO_BASE(chk->p_rtprio.type) == + RTP_PRIO_BASE(p->p_rtprio.type))))) + need_resched(); +} + +#define ROUNDROBIN_INTERVAL (hz / quantum) +int roundrobin_interval(void) +{ + return ROUNDROBIN_INTERVAL; +} + /* * Force switch among equal priority processes every 100ms. */ @@ -104,9 +124,12 @@ static void roundrobin(arg) void *arg; { + struct proc *p = curproc; /* XXX */ + + if (p == 0 || RTP_PRIO_NEED_RR(p->p_rtprio.type)) + need_resched(); - need_resched(); - timeout(roundrobin, NULL, hz / quantum); + timeout(roundrobin, NULL, ROUNDROBIN_INTERVAL); } /* @@ -496,7 +519,7 @@ restart: p->p_stat = SRUN; if (p->p_flag & P_INMEM) { setrunqueue(p); - need_resched(); + maybe_resched(p); } else { p->p_flag |= P_SWAPINREQ; wakeup((caddr_t)&proc0); @@ -541,7 +564,7 @@ wakeup_one(ident) p->p_stat = SRUN; if (p->p_flag & P_INMEM) { setrunqueue(p); - need_resched(); + maybe_resched(p); break; } else { p->p_flag |= P_SWAPINREQ; @@ -692,8 +715,8 @@ setrunnable(p) p->p_flag |= P_SWAPINREQ; wakeup((caddr_t)&proc0); } - else if (p->p_priority < curpriority) - need_resched(); + else + maybe_resched(p); } /* @@ -711,11 +734,8 @@ resetpriority(p) newpriority = PUSER + p->p_estcpu / 4 + 2 * p->p_nice; newpriority = min(newpriority, MAXPRI); p->p_usrpri = newpriority; - if (newpriority < curpriority) - need_resched(); - } else { - need_resched(); } + maybe_resched(p); } /* ARGSUSED */ |