> -----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
|