xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: peb1611 <peb1611@gmail.com>
To: George Dunlap <George.Dunlap@eu.citrix.com>,
	xen devel <xen-devel@lists.xensource.com>
Subject: Question about the credit2 sources in xen-unstable tree.
Date: Tue, 05 Apr 2011 17:17:26 +0900	[thread overview]
Message-ID: <4D9AD016.1060304@gmail.com> (raw)

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
applications.

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
*snext)
{
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) )
return CSCHED_MAX_TIMER;

/* 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 )
time = CSCHED_MIN_TIMER;
else if ( time > CSCHED_MAX_TIMER )
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?

Thanks

-- 
Eunbyung Park

             reply	other threads:[~2011-04-05  8:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05  8:17 peb1611 [this message]
2011-04-05  9:12 ` Question about the credit2 sources in xen-unstable tree George Dunlap
2011-04-05 12:33   ` peb1611

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D9AD016.1060304@gmail.com \
    --to=peb1611@gmail.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).