From 7cd0f83355058b1b3219abf3dfc42e05522b9a9b Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Tue, 17 Jun 2003 10:21:34 +0000 Subject: [PATCH] - Temporarily patch a problem where the interact score could be negative because the run time exceeds the largest value a signed int can hold. The real solution involves calculating how far we are over the limit. To quickly solve this problem we loop removing 1/5th of the current value until it falls below the limit. The common case requires no passes. --- sys/kern/sched_ule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index bd208e473f12..5cbc9910109b 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -627,7 +627,8 @@ sched_slice(struct kse *ke) static void sched_interact_update(struct ksegrp *kg) { - if ((kg->kg_runtime + kg->kg_slptime) > SCHED_SLP_RUN_MAX) { + /* XXX Fixme, use a linear algorithm and not a while loop. */ + while ((kg->kg_runtime + kg->kg_slptime) > SCHED_SLP_RUN_MAX) { kg->kg_runtime = (kg->kg_runtime / 5) * 4; kg->kg_slptime = (kg->kg_slptime / 5) * 4; }