From owner-cvs-src@FreeBSD.ORG Tue Jun 17 09:01:56 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 60F8F37B404 for ; Tue, 17 Jun 2003 09:01:56 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 9A15A43FB1 for ; Tue, 17 Jun 2003 09:01:54 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 54854 invoked by uid 1000); 17 Jun 2003 16:01:55 -0000 Date: Tue, 17 Jun 2003 09:01:55 -0700 (PDT) From: Nate Lawson To: Jeff Roberson In-Reply-To: <20030617102141.160C037B417@hub.freebsd.org> Message-ID: <20030617090055.N54837@root.org> References: <20030617102141.160C037B417@hub.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern sched_ule.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2003 16:01:57 -0000 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