From: Hirokazu Takahashi Subject: Re: Re: credit scheduler: the policy of credit assignment Date: Thu, 06 Jul 2006 08:54:41 +0900 (JST) Message-ID: <20060706.085441.41627071.taka@valinux.co.jp> References: <20060705.132350.66157177.taka@valinux.co.jp> <20060705101042.GA12087@cockermouth.uk.xensource.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20060705101042.GA12087@cockermouth.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: ack@xensource.com Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi Emmanuel, > > Hi Emmanuel, > > > > I looked into the code of the credit scheduler and one question > > has come up. > > > > I'm not sure whether it is your intention that once the value of > > credit_balance, which is the sum of credit of all domains on Xen, > > goes to zero it may be stuck at zero. It will happen all of them > > are cpu intensive domains and some of them turn into idle. > > > > Every 30 msec, the credit scheduler gives them csched_priv.credit > > milliseconds --- 30 msec * number of physical cpus ---. 30 msec later, > > you will find they have consumed all of the time they gave, which > > leads the value of credit_balance will keep zero. This means some > > domains are assigned credit with negative value every time. > > > > I know even in this case it will be balanced between domains > > based on the weights but it would take quite long time to be balanced. > > I feel the scheduler should give each domains larger credit than now > > when credit_balance is small. > > > > Am I something wrong about this? > > Credit_balance only comes into play when active domains with positive > credit go idle. It's a mechanism to converge the system towards its > stable state. Yes, I think I understand the intention. However, I don't think the mechanism is effective enough. > Are you suggesting that credit_balance, as it is used, should be the > sum of credit *prior* to incrementing active domains' credits? I think it would be better. > I'm not really sure I understand what you're concerned about here. > Can you elaborate and use a specific example to illustrate? Please suppose the system has 1 cpu and the sum of the credit goes down to zero or quite small value unluckily. credit Domain A 20 Domain B -10 Domain C -10 30msec later, the domains consumed 30msec if they are cpu intensive domains. The credits may become: Domain A 0 Domain B -15 Domain C -15 Then, the credit scheduler divides 30 msec and gives it to each domains. The credits may become: Domain A 15 Domain B -5 Domain C -10 The sum of the credit keeps the same value. I think there will be a chance to optimize it. Thansk, Hirokazu Takahashi.