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


Re: [Xen-devel] Credit Scheduler code question

To: Marco Antonio <spyke.me@xxxxxxxxx>
Subject: Re: [Xen-devel] Credit Scheduler code question
From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
Date: Fri, 20 Aug 2010 12:46:42 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 20 Aug 2010 04:49:13 -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; bh=60ZKgB2VPwtFaukzXscvppHfbOxFnbD0RwdKd56uY+w=; b=kjy3kDqFOiWqMbhKylxk9pREg58ediqxpVhoC3VTPfh+VEl5+cfwifLUtoYnqJJrEF irhEkFBtaSdu2kNkuIZBwvp2Djtqz1TaiGi6v5nFMNPNY1dgphep1FulT1eQa+ba2nmK epHWYnTcZ6lWJEDMByIG+eNJXPo2UwzELWe+c=
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; b=SjHF18D+9tXZhi99+Y/Ne7aMNTClwatuYjaX5chZgP+Vd1IvdaWxhLzX0l2SJzML/y CAoK20J+bXRaC6Uxv2AV3wjf1e2PpABHZkRESBTvlQBMGFdDpHZ+pMAkIIVY6M1YOboZ KGOBi24jTy17zc86bgV7jbjd/wBzVf4QoWrNQ=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <AANLkTinopU1PDLW2wWuLmnN70v7-2ZsdTQ_M3w_ORKJ9@xxxxxxxxxxxxxx>
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: <AANLkTinopU1PDLW2wWuLmnN70v7-2ZsdTQ_M3w_ORKJ9@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
The generic schedule code is in common/schedule.c and
arch/x86/domain.c.  common/schedule/schedule() calls
common/sched_credit.c/csched_schedule() to ask which vcpu should be
scheduled next on the current pcpu.  At the bottom of that function,
it calls context_switch(), which can be found in arch/x86/domain.c.
__context_switch() in that same file does the register changing; and
schedule_tail() at the bottom of context_switch() is what will
actually jump back into the vcpu if necessary.

Does that help?

If you just want to see what vcpus are doing, you can use xentrace to
trace runstate-change events, and then use xenalyze to analyze them.

Xenalyze can be found here:

> I think that it would also be helpfull to know how functions in the struct
> scheduler sched_credit_def are called.

One thing that may help you to grok the source code is the following magic rune:
 $ find . -name "*.[cSh]" | xargs grep -H {something I'm looking for}

For example, you could have used this to search for "->do_schedule",
and found that it was only called from common/schedule.c:schedule().

You can use rgrep as well, but that doesn't allow you to focus on a
specific subset of files.  :-)


On Thu, Aug 19, 2010 at 7:05 PM, Marco Antonio <spyke.me@xxxxxxxxx> wrote:
> Hi,
> I'm a PhD student trying to add some load balancing code to the credit
> scheduler in order to fit some specific necessities. I'm trying to
> understand the credit scheduler code and I don't quite get in which part of
> it a pcpu starts running a vcpu. I need to keep track of when a vpcu starts
> running in a cpu and when it stops. Any hint on that?
> Thanks,
> Marco.
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

Xen-devel mailing list

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