All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>
Cc: Jerone Young <jyoung5@us.ibm.com>,
	xen-devel <xen-devel@lists.sourceforge.net>,
	ian.pratt@cl.cam.ac.uk
Subject: Re: Calculating real cpu usage of Xen domains correctly!
Date: Wed, 23 Feb 2005 21:10:05 -0600	[thread overview]
Message-ID: <421D458D.2090906@us.ibm.com> (raw)
In-Reply-To: <A95E2296287EAD4EB592B5DEEFCE0E9D123A5B@liverpoolst.ad.cl.cam.ac.uk>

Ian Pratt wrote:

>I would expect it to return the cumulative total CPU time in ns that the
>domain has received.
>  
>
I think what's happening is that cpu_time is being updated even if the 
domain is blocked. Looking in xen/common/schedule.c:__enter_scheduler(), 
the update to cpu_time is still being updated even if SCHED_OP(do_block, 
prev) is invoked. Honestly, I don't understand this code that well but I 
made the following change:

--- schedule.c~ 2005-02-21 22:19:31.000000000 -0600
+++ schedule.c 2005-02-23 19:44:52.000000000 -0600
@@ -389,13 +389,15 @@
{
/* This check is needed to avoid a race condition. */
if ( event_pending(prev) )
+ {
clear_bit(EDF_BLOCKED, &prev->ed_flags);
- else
+ prev->cpu_time += now - prev->lastschd;
+ } else
SCHED_OP(do_block, prev);
+ } else {
+ prev->cpu_time += now - prev->lastschd;
}

- prev->cpu_time += now - prev->lastschd;
-
/* get policy-specific decision on scheduling... */
next_slice = ops.do_schedule(now);

And cpu_time contained what it should contain. Before, if I ran a simple 
infinite loop in a domU (while true; do true; done), it would report 
dom0 and domU both using 99% of the CPU.

Now it shows domU using 99% of the CPU and dom0 using 1%. This is 
probably the wrong way to fix this problem but hopefully it makes the 
right solution obvious to someone who knows this code better.

Regards,
Anthony Liguori

Signed-off-by: Anthony Liguori

>If it doesn't I'd regard it as a bug.
>
>Seperately, we should make sure we store a total cumulative time that
>each CPU has been executing domains (other than idle).
>
>Ian
>
>  
>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

  reply	other threads:[~2005-02-24  3:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-24  2:37 Calculating real cpu usage of Xen domains correctly! Ian Pratt
2005-02-24  3:10 ` Anthony Liguori [this message]
2005-02-24 13:56   ` John L Griffin
2005-02-24 20:43     ` Anthony Liguori
2005-02-24 21:46       ` John L Griffin
2005-02-24 22:02         ` Keir Fraser
2005-02-24 23:01         ` Anthony Liguori
2005-02-25  3:53           ` John L Griffin
2005-02-25 10:31         ` Stephan Diestelhorst
2005-02-25 10:38         ` Stephan Diestelhorst
  -- strict thread matches above, loose matches on Subject: below --
2005-02-24  0:48 Ian Pratt
2005-02-24  1:02 ` Anthony Liguori
2005-02-24  2:10   ` Andrew Theurer
2005-02-25  2:25   ` Matt Ayres
2005-02-25  2:38     ` Anthony Liguori
2005-02-25 16:44       ` Rob Gardner
2005-02-25 17:10         ` Anthony Liguori
2005-02-23 23:29 Jerone Young
2005-02-23 23:44 ` Anthony Liguori

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=421D458D.2090906@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=ian.pratt@cl.cam.ac.uk \
    --cc=jyoung5@us.ibm.com \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=xen-devel@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.