diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 1039f3dca990..a14299374584 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.24 1996/09/01 10:30:33 davidg Exp $ + * $Id: kern_synch.c,v 1.25 1996/09/22 06:35:24 gpalmer Exp $ */ #include "opt_ktrace.h" @@ -461,6 +461,7 @@ restart: setrunqueue(p); need_resched(); } else { + p->p_flag |= P_SWAPINREQ; wakeup((caddr_t)&proc0); } /* END INLINE EXPANSION */ @@ -506,6 +507,7 @@ wakeup_one(ident) need_resched(); break; } else { + p->p_flag |= P_SWAPINREQ; wakeup((caddr_t)&proc0); } /* END INLINE EXPANSION */ @@ -624,8 +626,10 @@ setrunnable(p) if (p->p_slptime > 1) updatepri(p); p->p_slptime = 0; - if ((p->p_flag & P_INMEM) == 0) + if ((p->p_flag & P_INMEM) == 0) { + p->p_flag |= P_SWAPINREQ; wakeup((caddr_t)&proc0); + } else if (p->p_priority < curpriority) need_resched(); } diff --git a/sys/sys/proc.h b/sys/sys/proc.h index f4679f19da85..bac0b804f80b 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $Id: proc.h,v 1.28 1996/09/13 09:20:08 bde Exp $ + * $Id: proc.h,v 1.29 1996/10/12 16:11:58 bde Exp $ */ #ifndef _SYS_PROC_H_ @@ -215,6 +215,7 @@ struct proc { #define P_OWEUPC 0x20000 /* Owe process an addupc() call at next ast. */ #define P_SWAPPING 0x40000 /* Process is being swapped. */ +#define P_SWAPINREQ 0x80000 /* Swapin request due to wakeup */ /* * MOVE TO ucred.h? diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index a76bdeb528ac..af888fa9fda1 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -59,7 +59,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_glue.c,v 1.53 1996/09/15 11:24:21 bde Exp $ + * $Id: vm_glue.c,v 1.54 1996/10/15 03:16:44 dyson Exp $ */ #include @@ -319,7 +319,10 @@ loop: (p->p_flag & (P_INMEM | P_SWAPPING)) == 0) { int mempri; - pri = p->p_swtime + p->p_slptime - p->p_nice * 8; + pri = p->p_swtime + p->p_slptime; + if ((p->p_flag & P_SWAPINREQ) == 0) { + pri -= p->p_nice * 8; + } mempri = pri > 0 ? pri : 0; /* * if this process is higher priority and there is @@ -334,12 +337,14 @@ loop: } /* - * Nothing to do, back to sleep + * Nothing to do, back to sleep. */ if ((p = pp) == NULL) { tsleep(&proc0, PVM, "sched", 0); goto loop; } + p->p_flag &= ~P_SWAPINREQ; + /* * We would like to bring someone in. (only if there is space). */