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: Thomas Pfeuffer <thomas.pfeuffer@xxxxxxxx>
Subject: Re: [Xen-devel] Question on Credit accounting in Credit Scheduler
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Thu, 29 Jul 2010 14:35:22 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 29 Jul 2010 06:36:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1280409687.8054.18.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
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