remove spurious high ipl's
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Sat, 18 Apr 1981 08:54:50 +0000 (00:54 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Sat, 18 Apr 1981 08:54:50 +0000 (00:54 -0800)
SCCS-vsn: sys/vax/vax/locore.s 4.44
SCCS-vsn: sys/kern/tty_subr.c 4.11
SCCS-vsn: sys/kern/kern_synch.c 4.13
SCCS-vsn: sys/vm/vm_meter.c 4.5

usr/src/sys/kern/kern_synch.c
usr/src/sys/kern/tty_subr.c
usr/src/sys/vax/vax/locore.s
usr/src/sys/vm/vm_meter.c

index 79f87ca..2f2596f 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_synch.c    4.12    81/04/15        */
+/*     kern_synch.c    4.13    81/04/17        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -173,9 +173,12 @@ restart:
                                        runrun++;
                                        aston();
                                }
                                        runrun++;
                                        aston();
                                }
-                               if(runout != 0 && (p->p_flag&SLOAD) == 0) {
-                                       runout = 0;
-                                       wakeup((caddr_t)&runout);
+                               if ((p->p_flag&SLOAD) == 0) {
+                                       if (runout != 0) {
+                                               runout = 0;
+                                               wakeup((caddr_t)&runout);
+                                       }
+                                       wantin++;
                                }
                                /* END INLINE EXPANSION */
                                goto restart;
                                }
                                /* END INLINE EXPANSION */
                                goto restart;
@@ -233,9 +236,12 @@ register struct proc *p;
                runrun++;
                aston();
        }
                runrun++;
                aston();
        }
-       if(runout != 0 && (p->p_flag&SLOAD) == 0) {
-               runout = 0;
-               wakeup((caddr_t)&runout);
+       if ((p->p_flag&SLOAD) == 0) {
+               if(runout != 0) {
+                       runout = 0;
+                       wakeup((caddr_t)&runout);
+               }
+               wantin++;
        }
 }
 
        }
 }
 
index 495c874..7558bf6 100644 (file)
@@ -1,4 +1,4 @@
-/*     tty_subr.c      4.10    81/03/09        */
+/*     tty_subr.c      4.11    81/04/17        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -18,7 +18,7 @@ register struct clist *p;
        register struct cblock *bp;
        register int c, s;
 
        register struct cblock *bp;
        register int c, s;
 
-       s = spl6();
+       s = spl5();
        if (p->c_cc <= 0) {
                c = -1;
                p->c_cc = 0;
        if (p->c_cc <= 0) {
                c = -1;
                p->c_cc = 0;
@@ -68,7 +68,7 @@ register char *cp;
 
        if (cc <= 0)
                return(0);
 
        if (cc <= 0)
                return(0);
-       s = spl6();
+       s = spl5();
        if (q->c_cc <= 0) {
                q->c_cc = 0;
                q->c_cf = q->c_cl = NULL;
        if (q->c_cc <= 0) {
                q->c_cc = 0;
                q->c_cf = q->c_cl = NULL;
@@ -121,7 +121,7 @@ register struct clist *q;
 register cc;
 int s;
 
 register cc;
 int s;
 
-       s = spl6();
+       s = spl5();
        if (q->c_cc <= 0) {
                cc = -q->c_cc;
                goto out;
        if (q->c_cc <= 0) {
                cc = -q->c_cc;
                goto out;
@@ -164,7 +164,7 @@ char *end;
 int rem;
 register s;
 
 int rem;
 register s;
 
-       s = spl6();
+       s = spl5();
        if (q->c_cc < 0) {
                printf("neg q flush\n");
                goto out;
        if (q->c_cc < 0) {
                printf("neg q flush\n");
                goto out;
@@ -222,7 +222,7 @@ register struct clist *p;
        register char *cp;
        register s;
 
        register char *cp;
        register s;
 
-       s = spl6();
+       s = spl5();
        if ((cp = p->c_cl) == NULL || p->c_cc < 0 ) {
                if ((bp = cfreelist) == NULL) {
                        splx(s);
        if ((cp = p->c_cl) == NULL || p->c_cc < 0 ) {
                if ((bp = cfreelist) == NULL) {
                        splx(s);
@@ -271,7 +271,7 @@ register int cc;
        acc = cc;
 
 
        acc = cc;
 
 
-       s = spl6();
+       s = spl5();
        if ((cq = q->c_cl) == NULL || q->c_cc < 0) {
                if ((bp = cfreelist) == NULL) 
                        goto out;
        if ((cq = q->c_cl) == NULL || q->c_cc < 0) {
                if ((bp = cfreelist) == NULL) 
                        goto out;
@@ -334,7 +334,7 @@ register struct clist *p;
        register int c, s;
        struct cblock *obp;
 
        register int c, s;
        struct cblock *obp;
 
-       s = spl6();
+       s = spl5();
        if (p->c_cc <= 0)
                c = -1;
        else {
        if (p->c_cc <= 0)
                c = -1;
        else {
@@ -402,7 +402,7 @@ register struct clist *p;
 {
        register s;
 
 {
        register s;
 
-       s = spl6();
+       s = spl5();
        if (cfreelist==NULL) {
                splx(s);
                return(-1);
        if (cfreelist==NULL) {
                splx(s);
                return(-1);
index 15dbaa8..d0a8336 100644 (file)
@@ -1,4 +1,4 @@
-/*     locore.s        4.43    81/04/15        */
+/*     locore.s        4.44    81/04/17        */
 
 #include "../h/mtpr.h"
 #include "../h/trap.h"
 
 #include "../h/mtpr.h"
 #include "../h/trap.h"
@@ -770,12 +770,9 @@ _Subyte:
  */
 _copyseg:      .globl  _copyseg
        .word   0x0
  */
 _copyseg:      .globl  _copyseg
        .word   0x0
-       mfpr    $IPL,r0         # get current pri level
-       mtpr    $HIGH,$IPL      # turn off interrupts
        bisl3   $PG_V|PG_KW,8(ap),_CMAP2
        mtpr    $_CADDR2,$TBIS  # invalidate entry for copy 
        movc3   $NBPG,*4(ap),_CADDR2
        bisl3   $PG_V|PG_KW,8(ap),_CMAP2
        mtpr    $_CADDR2,$TBIS  # invalidate entry for copy 
        movc3   $NBPG,*4(ap),_CADDR2
-       mtpr    r0,$IPL         # restore pri level
        ret
 
 /*
        ret
 
 /*
@@ -784,12 +781,9 @@ _copyseg:  .globl  _copyseg
  */
 _clearseg:     .globl  _clearseg
        .word   0x0
  */
 _clearseg:     .globl  _clearseg
        .word   0x0
-       mfpr    $IPL,r0         # get current pri level
-       mtpr    $HIGH,$IPL      # extreme pri level
        bisl3   $PG_V|PG_KW,4(ap),_CMAP1
        mtpr    $_CADDR1,$TBIS
        movc5   $0,(sp),$0,$NBPG,_CADDR1
        bisl3   $PG_V|PG_KW,4(ap),_CMAP1
        mtpr    $_CADDR1,$TBIS
        movc5   $0,(sp),$0,$NBPG,_CADDR1
-       mtpr    r0,$IPL         # restore pri level
        ret
 
 /*
        ret
 
 /*
index 91932cd..addb677 100644 (file)
@@ -1,4 +1,4 @@
-/*     vm_meter.c      4.4     81/03/09        */
+/*     vm_meter.c      4.5     81/04/17        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -81,7 +81,7 @@ sched()
         * amount of free memory.
         */
 loop:
         * amount of free memory.
         */
 loop:
-       (void) spl6();
+       wantin = 0;
        deservin = 0;
        sleeper = 0;
        p = 0;
        deservin = 0;
        sleeper = 0;
        p = 0;
@@ -121,11 +121,12 @@ loop:
                    swappable(rp)) {
                        /*
                         * Kick out deadwood.
                    swappable(rp)) {
                        /*
                         * Kick out deadwood.
-                        * FOLLOWING 3 LINES MUST BE AT spl6().
                         */
                         */
+                       (void) spl6();
                        rp->p_flag &= ~SLOAD;
                        if (rp->p_stat == SRUN)
                                remrq(rp);
                        rp->p_flag &= ~SLOAD;
                        if (rp->p_stat == SRUN)
                                remrq(rp);
+                       (void) spl0();
                        (void) swapout(rp, rp->p_dsize, rp->p_ssize);
                        goto loop;
                }
                        (void) swapout(rp, rp->p_dsize, rp->p_ssize);
                        goto loop;
                }
@@ -136,11 +137,17 @@ loop:
         * No one wants in, so nothing to do.
         */
        if (outpri == -20000) {
         * No one wants in, so nothing to do.
         */
        if (outpri == -20000) {
-               runout++;
-               sleep((caddr_t)&runout, PSWP);
+               (void) spl6();
+               if (wantin) {
+                       wantin = 0;
+                       sleep((caddr_t)&lbolt, PSWP);
+               } else {
+                       runout++;
+                       sleep((caddr_t)&runout, PSWP);
+               }
+               (void) spl0();
                goto loop;
        }
                goto loop;
        }
-       (void) spl0();
        /*
         * Decide how deserving this guy is.  If he is deserving
         * we will be willing to work harder to bring him in.
        /*
         * Decide how deserving this guy is.  If he is deserving
         * we will be willing to work harder to bring him in.
@@ -171,7 +178,6 @@ hardswap:
         * Select the nbig largest jobs, then the oldest of these
         * is ``most likely to get booted.''
         */
         * Select the nbig largest jobs, then the oldest of these
         * is ``most likely to get booted.''
         */
-       (void) spl6();
        inp = p;
        sleeper = 0;
        if (nbig > MAXNBIG)
        inp = p;
        sleeper = 0;
        if (nbig > MAXNBIG)
@@ -236,9 +242,11 @@ hardswap:
         * we kick the poor luser out.
         */
        if (sleeper || desperate && p || deservin && inpri > maxslp) {
         * we kick the poor luser out.
         */
        if (sleeper || desperate && p || deservin && inpri > maxslp) {
+               (void) spl6();
                p->p_flag &= ~SLOAD;
                if (p->p_stat == SRUN)
                        remrq(p);
                p->p_flag &= ~SLOAD;
                if (p->p_stat == SRUN)
                        remrq(p);
+               (void) spl0();
                if (desperate) {
                        /*
                         * Want to give this space to the rest of
                if (desperate) {
                        /*
                         * Want to give this space to the rest of
@@ -262,6 +270,7 @@ hardswap:
        (void) spl6();
        runin++;
        sleep((caddr_t)&runin, PSWP);
        (void) spl6();
        runin++;
        sleep((caddr_t)&runin, PSWP);
+       (void) spl0();
        goto loop;
 }
 
        goto loop;
 }