WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

AW: [Xen-devel] Question on Credit accounting in Credit Scheduler

To: "'Thomas Pfeuffer'" <thomas.pfeuffer@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: AW: [Xen-devel] Question on Credit accounting in Credit Scheduler
From: "Heiko Wundram" <modelnine@xxxxxxxxxxxxx>
Date: Thu, 29 Jul 2010 15:40:20 +0200
Cc:
Delivery-date: Thu, 29 Jul 2010 06:41:28 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1280409687.8054.18.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: modelnine.org
References: <1280409687.8054.18.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcsvIcJGhtc0RxW6RwCuYGaL0J4UyAAAMjUw
> -----Ursprüngliche Nachricht-----
> Von: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx [mailto:xen-devel-
> bounces@xxxxxxxxxxxxxxxxxxx] Im Auftrag von Thomas Pfeuffer
> Gesendet: Donnerstag, 29. Juli 2010 15:21
> An: xen-devel@xxxxxxxxxxxxxxxxxxx
> Betreff: [Xen-devel] Question on Credit accounting in Credit Scheduler
> 
> I have looked through the source code of Credit Scheduler.
> 
> In csched_acct(), the number of credits a domain gets (i.e
> credit_fair),
> is calculated as follows:
> 
>      credit_fair = ( ( credit_total * sdom->weight) + ( weight_total -
> 1)
>                   ) / weigth_total
> 
> But I would expect, that the Credits are calculated by
> 
>      credit_fair = (credit_total * sdom->weight) / weigth_total
> 
> 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ßklammer", 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.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel