cvs commit: src/sys/kern sched_ule.c
Nate Lawson
nate at root.org
Tue Jun 17 09:01:57 PDT 2003
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
More information about the cvs-src
mailing list