- 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.
This commit is contained in:
Jeff Roberson 2003-06-17 10:21:34 +00:00
parent b49349cfce
commit 7cd0f83355
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=116479

View File

@ -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;
}