summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_synch.c2
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/proc.h8
-rw-r--r--sys/sys/resource.h3
4 files changed, 9 insertions, 6 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 3ae903d39d52..17547de96403 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -916,7 +916,7 @@ resetpriority(p)
if (p->p_rtprio.type == RTP_PRIO_NORMAL) {
newpriority = PUSER + p->p_estcpu / INVERSE_ESTCPU_WEIGHT +
- NICE_WEIGHT * p->p_nice;
+ NICE_WEIGHT * (p->p_nice - PRIO_MIN);
newpriority = min(newpriority, MAXPRI);
p->p_usrpri = newpriority;
}
diff --git a/sys/sys/param.h b/sys/sys/param.h
index adf47716cdfe..52ea28dd27be 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -111,7 +111,7 @@
#define PCONFIG 32
#define PLOCK 36
#define PPAUSE 40
-#define PUSER 50
+#define PUSER 48
#define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */
#define PRIMASK 0x0ff
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index d75f033581a2..af7f110603cd 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -404,12 +404,12 @@ extern int whichidqs; /* Bit mask summary of non-empty Q's. */
* 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 NICE_WEIGHT 1 /* priorities per nice level */
#define PPQ (128 / NQS) /* priorities per queue */
+#define ESTCPULIM(e) \
+ min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * PRIO_TOTAL - PPQ) + \
+ INVERSE_ESTCPU_WEIGHT - 1)
extern u_long ps_arg_cache_limit;
extern int ps_argsopen;
diff --git a/sys/sys/resource.h b/sys/sys/resource.h
index a1220c00a7f9..ed2ecb3a42de 100644
--- a/sys/sys/resource.h
+++ b/sys/sys/resource.h
@@ -42,6 +42,9 @@
*/
#define PRIO_MIN -20
#define PRIO_MAX 20
+#ifdef _KERNEL
+#define PRIO_TOTAL (PRIO_MAX - PRIO_MIN)
+#endif /* _KERNEL */
#define PRIO_PROCESS 0
#define PRIO_PGRP 1