[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Question on Credit accounting in Credit Scheduler
I'd thought of writing a div_round_up() macro that would make this a bit more clear, something like: /* Divide x by y, rounding up */ #div_round_up(x, y) (((x)+((y)-1))/(y)) -George On Thu, Jul 29, 2010 at 2:35 PM, Tim Deegan <Tim.Deegan@xxxxxxxxxx> wrote: > 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 > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |