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

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

To: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Subject: Re: [Xen-devel] Question on Credit accounting in Credit Scheduler
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
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=C16yXF1BF/msqaxEA5q+7zK0Uh3qzh99F/kSpTyZ1gQ=; b=Whzn8WIHQ0teRJ0rF2Gy2GGLT1fS6XCE8nSwBAIt9+4s2Gv0pEPMnbBkumvMzz6IHu 5LN9X0guhzxJb4Ft2Vd/LzOi7G+mEwV9Jr4o5n8qQZlNPVcJE0NKGWXIdrBoGegQIDkA BpZ64SSRfivRIFL+HnWFVrKymlxqEOiuG4zMQ=
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=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20100729133522.GW13291@xxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <1280409687.8054.18.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20100729133522.GW13291@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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