Make processes waken up eligible for immediate swap-in.

This commit is contained in:
John Dyson 1996-10-17 02:58:20 +00:00
parent ad98052216
commit a669a6e9a9
3 changed files with 16 additions and 6 deletions

View File

@ -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();
}

View File

@ -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?

View File

@ -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 <sys/param.h>
@ -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).
*/