Date: Tue, 17 Jun 2003 09:01:55 -0700 (PDT) From: Nate Lawson <nate@root.org> To: Jeff Roberson <jeff@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern sched_ule.c Message-ID: <20030617090055.N54837@root.org> In-Reply-To: <20030617102141.160C037B417@hub.freebsd.org> References: <20030617102141.160C037B417@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 17 Jun 2003, Jeff Roberson wrote: > - 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. > > --- src/sys/kern/sched_ule.c:1.42 Mon Jun 16 23:39:51 2003 > +++ src/sys/kern/sched_ule.c Tue Jun 17 03:21:34 2003 > @@ -627,7 +627,8 @@ > 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; > } Couldn't you just use % (mod)? -Nate
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030617090055.N54837>