[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



At 14:21 +0100 on 29 Jul (1280413287), Thomas Pfeuffer wrote:
> Hello, 
> 
> 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?

It makes the integer division round up instead of rounding down. 

Tim.

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.