summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-08-09 10:13:32 +0000
committerdyson <dyson@FreeBSD.org>1997-08-09 10:13:32 +0000
commitc38957d22b79e58dcfc2f1111afcbbc0019cfe89 (patch)
tree032e068c65840f25e7fb938a4469b88eb574d5fd /sys/kern/subr_trap.c
parent4843904b0d4173aaa56c2fb2ffd890565f7a2198 (diff)
downloadFreeBSD-src-c38957d22b79e58dcfc2f1111afcbbc0019cfe89.zip
FreeBSD-src-c38957d22b79e58dcfc2f1111afcbbc0019cfe89.tar.gz
Modify the scheduling policy to take into account disk I/O waits
as chargeable CPU usage. This should mitigate the problem of processes doing disk I/O hogging the CPU. Various users have reported the problem, and test code shows that the problem should now be gone.
Diffstat (limited to 'sys/kern/subr_trap.c')
-rw-r--r--sys/kern/subr_trap.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c
index 7110933..516925f 100644
--- a/sys/kern/subr_trap.c
+++ b/sys/kern/subr_trap.c
@@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
- * $Id: trap.c,v 1.101 1997/07/20 08:37:23 bde Exp $
+ * $Id: trap.c,v 1.102 1997/08/09 00:02:52 dyson Exp $
*/
/*
@@ -144,6 +144,19 @@ userret(p, frame, oticks)
while ((sig = CURSIG(p)) != 0)
postsig(sig);
+
+#if !defined(NO_SCHEDULE_MODS)
+ if (!want_resched &&
+ (p->p_priority <= p->p_usrpri) &&
+ (p->p_rtprio.type == RTP_PRIO_NORMAL)) {
+ int newpriority;
+ p->p_estcpu += 1;
+ newpriority = PUSER + p->p_estcpu / 4 + 2 * p->p_nice;
+ newpriority = min(newpriority, MAXPRI);
+ p->p_usrpri = newpriority;
+ }
+#endif
+
p->p_priority = p->p_usrpri;
if (want_resched) {
/*
OpenPOWER on IntegriCloud