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

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


  • To: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
  • From: George Dunlap <dunlapg@xxxxxxxxx>
  • Date: Thu, 29 Jul 2010 14:42:53 +0100
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Thomas Pfeuffer <thomas.pfeuffer@xxxxxxxx>
  • Delivery-date: Thu, 29 Jul 2010 06:44:55 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=YkTZBd/k2xTZBzlvgTKzvhtr7bESRHzwo99sMge4Y5SjwFCvPFVlejH9Q0Z1aQV83s SYX5i2fvux/2VqL3bCMKYe6R2NoGP0AUv/rqxlsGIo+JAibNhZU0Yw2hqxJ0HaMlficO OoC+aW2cTmiuIN3kO4tgfs79oKIka2GFEbb4s=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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


 


Rackspace

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