X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/41888f1633c1339d2f01b12ee2799c96530262dd..a935bc3c7775524194c7eb6c25ebf51a08dfdd03:/usr/src/sys/kern/kern_clock.c diff --git a/usr/src/sys/kern/kern_clock.c b/usr/src/sys/kern/kern_clock.c index 158a9a8667..5b2970862c 100644 --- a/usr/src/sys/kern/kern_clock.c +++ b/usr/src/sys/kern/kern_clock.c @@ -1,7 +1,8 @@ -/* %H% 3.12 kern_clock.c */ +/* %H% 3.19 kern_clock.c */ #include "../h/param.h" #include "../h/systm.h" +#include "../h/dk.h" #include "../h/callo.h" #include "../h/seg.h" #include "../h/dir.h" @@ -12,6 +13,9 @@ #include "../h/vm.h" #include "../h/buf.h" #include "../h/text.h" +#include "../h/vlimit.h" +#include "../h/mtpr.h" +#include "../h/clock.h" #define SCHMAG 9/10 @@ -124,6 +128,11 @@ out: } if (s > u.u_vm.vm_maxrss) u.u_vm.vm_maxrss = s; + if ((u.u_vm.vm_utime+u.u_vm.vm_stime+1)/HZ > u.u_limit[LIM_CPU]) { + psignal(u.u_procp, SIGXCPU); + if (u.u_limit[LIM_CPU] < INFINITY - 5) + u.u_limit[LIM_CPU] += 5; + } } if (USERMODE(ps)) { u.u_vm.vm_utime++; @@ -155,15 +164,25 @@ out: runrun++; } if (lbolt >= HZ) { + extern int hangcnt; + if (BASEPRI(ps)) return; lbolt -= HZ; ++time; (void) spl1(); + /* + * machdep.c:unhang uses hangcnt to make sure uba + * doesn't forget to interrupt (this has been observed). + * This prevents an accumulation of < 5 second uba failures + * from summing to a uba reset. + */ + if (hangcnt) + hangcnt--; runrun++; wakeup((caddr_t)&lbolt); for(pp = &proc[0]; pp < &proc[NPROC]; pp++) - if (pp->p_stat && pp->p_statp_stat && pp->p_stat!=SZOMB) { if(pp->p_time != 127) pp->p_time++; if(pp->p_clktim) @@ -226,16 +245,16 @@ out: */ if (bclnlist != NULL) wakeup((caddr_t)&proc[2]); -#ifdef ERNIE if (USERMODE(ps)) { pp = u.u_procp; +#ifdef ERNIE if (pp->p_uid) if (pp->p_nice == NZERO && u.u_vm.vm_utime > 600 * HZ) pp->p_nice = NZERO+4; (void) setpri(pp); pp->p_pri = pp->p_usrpri; - } #endif + } } if (!BASEPRI(ps)) unhang();