From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Heiko Wundram" Subject: AW: Question on Credit accounting in Credit Scheduler Date: Thu, 29 Jul 2010 15:40:20 +0200 Message-ID: <014c01cb2f23$9733b420$c59b1c60$@org> References: <1280409687.8054.18.camel@bmwve02.lpr.e-technik.tu-muenchen.de> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1280409687.8054.18.camel@bmwve02.lpr.e-technik.tu-muenchen.de> Content-Language: de List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: 'Thomas Pfeuffer' , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org > -----Urspr=FCngliche Nachricht----- > Von: xen-devel-bounces@lists.xensource.com [mailto:xen-devel- > bounces@lists.xensource.com] Im Auftrag von Thomas Pfeuffer > Gesendet: Donnerstag, 29. Juli 2010 15:21 > An: xen-devel@lists.xensource.com > Betreff: [Xen-devel] Question on Credit accounting in Credit Scheduler >=20 > I have looked through the source code of Credit Scheduler. >=20 > In csched_acct(), the number of credits a domain gets (i.e > credit_fair), > is calculated as follows: >=20 > credit_fair =3D ( ( credit_total * sdom->weight) + ( weight_total = - > 1) > ) / weigth_total >=20 > But I would expect, that the Credits are calculated by >=20 > credit_fair =3D (credit_total * sdom->weight) / weigth_total >=20 > Does anybody know, what function the term (weight_total -1) has? Without knowing details of the Xen scheduling algorithm (i.e., I'm = guessing that the above is integer-only math), all it does is "round up" the = (fair) credits a domain gets [(x+y-1)/y means division with always rounding up, think of the "Gau=DFklammer", don't know the german name, in reverse]; basically, if the above calculation is done for all domains, the = respective sum of all calculated credit_fair will always be equal to or higher than credit_total, which wouldn't be the case (because of truncation when = just doing x/y) when using your function, i.e. the sum of all credit_fair = might be less than credit_total. For a scheduling algorithm, you'll want to always give away _at least_ = all available credits, and this is a simple enough method to do just that without resorting to floating point calculations. --- Heiko.