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/
Home Products Support Community News


[Xen-devel] Question about the credit2 sources in xen-unstable tree.

To: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, xen devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Question about the credit2 sources in xen-unstable tree.
From: peb1611 <peb1611@xxxxxxxxx>
Date: Tue, 05 Apr 2011 17:17:26 +0900
Delivery-date: Tue, 05 Apr 2011 01:18:24 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=7hLEEOW6/Hll5aP90agPoMCXX6BOBCGz1NscwEHbXMo=; b=vS5FjN2QGskLrTAEx6ASF47ydtOD5ArWYQuDQZE0NOei0drsDoXJpseB8Gtp+MrSvB YDcyWZpkRFOS0dLfZ480dm7zb/TksMlMZN0vmo8hWqPFDJzZvHQY9s31ZH8f7xH7cUn8 UoSDv8Xe3DQJA5PPyqffR8pCFksBrBNEte8qs=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=ILcGOp9hQ+IsIErxwPTyVshQsgbc8LDay729D2TrBP23MbZKtfjel5kYnt1OWmFllA NyeM9dLJ9LT2V/r/yglIqIBuz/gWFh2DxW4nAzwWjbYmmVyUDhtaitO91GO9YZ6b+AL/ KhzcILbzUZ+0vglVPVP6Uwh1nNgy9DRJhkJas=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ko; rv: Gecko/20110303 Thunderbird/3.1.9
Hi, all

I am analyzing the credit2 scheduler in order to adopt to my own private
cloud, which should satisfy the conditions of some latency sensitive

In the latest xen-unstable repository, which is tip tags, I found some
codes that is not understandable to me.

In the xen/common/sched_credit2.c,

/* How long should we let this vcpu run for? */
static s_time_t
csched_runtime(const struct scheduler *ops, int cpu, struct csched_vcpu
s_time_t time = CSCHED_MAX_TIMER;
struct csched_runqueue_data *rqd = RQD(ops, cpu);
struct list_head *runq = &rqd->runq;

if ( is_idle_vcpu(snext->vcpu) )

/* Basic time */
time = c2t(rqd, snext->credit, snext);

/* Next guy on runqueue */
if ( ! list_empty(runq) )
struct csched_vcpu *svc = __runq_elem(runq->next);
s_time_t ntime;

if ( ! is_idle_vcpu(svc->vcpu) )
ntime = c2t(rqd, snext->credit - svc->credit, snext);

if ( time > ntime )
time = ntime;

/* Check limits */
if ( time < CSCHED_MIN_TIMER )
else if ( time > CSCHED_MAX_TIMER )

return time;

As I understand, this function is used to determining the next vcpu's
running time-slice from now to the next scheduling event.

So, what does this code mean?

if ( time > ntime )
time = ntime;

actually, I think it is not different as

if ( svc->credit > 0 )
time = ntime;

If so, It means that if credits of the next guy on runqueue are not
negative caculated time-slice is snext's time, or time of the next guy
is selected and then eventually saturated by the CSCHED_MIN_TIMER.

what is the implication of it?

Am I correct ? If not, would you please kindly let me know about the
mecahnism of caculating the next-time slice?


Eunbyung Park

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>