diff options
-rw-r--r-- | sys/kern/kern_exit.c | 6 | ||||
-rw-r--r-- | sys/sys/proc.h | 13 |
2 files changed, 15 insertions, 4 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 7a2b5b3..961738d 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -62,8 +62,6 @@ #include <sys/aio.h> #include <sys/jail.h> -#include <machine/limits.h> /* for UCHAR_MAX = typeof(p_priority)_MAX */ - #include <vm/vm.h> #include <vm/vm_param.h> #include <sys/lock.h> @@ -430,8 +428,8 @@ loop: if (p->p_stat == SZOMB) { /* charge childs scheduling cpu usage to parent */ if (curproc->p_pid != 1) { - curproc->p_estcpu = min(curproc->p_estcpu + - p->p_estcpu, UCHAR_MAX); + curproc->p_estcpu = + ESTCPULIM(curproc->p_estcpu + p->p_estcpu); } q->p_retval[0] = p->p_pid; diff --git a/sys/sys/proc.h b/sys/sys/proc.h index de6ccca..d126fd6 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -383,6 +383,19 @@ extern int whichqs; /* Bit mask summary of non-empty Q's. */ extern int whichrtqs; /* Bit mask summary of non-empty Q's. */ extern int whichidqs; /* Bit mask summary of non-empty Q's. */ +/* + * XXX macros for scheduler. Shouldn't be here, but currently needed for + * bounding the dubious p_estcpu inheritance in wait1(). + * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in + * the range 100-256 Hz (approximately). + */ +#define ESTCPULIM(e) \ + min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * PRIO_MAX - PPQ) + \ + INVERSE_ESTCPU_WEIGHT - 1) +#define INVERSE_ESTCPU_WEIGHT 8 /* 1 / (priorities per estcpu level) */ +#define NICE_WEIGHT 2 /* priorities per nice level */ +#define PPQ (128 / NQS) /* priorities per queue */ + extern u_long ps_arg_cache_limit; extern int ps_argsopen; |