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] [PATCH 1/2] cpu steal time accounting

On 22 Feb 2006, at 17:11, Rik van Riel wrote:

If the domain is unrunnable, surely there won't be a
process on the virtual cpu that is runnable?  Or am
I overlooking something here?

Oh, I see, this is dealt with inside account_steal_time(). No problem then.

1. What if a guest gets preempted for lots of short time periods (less
than a jiffy). Then some arbitrary time in the future is preempted for
long enough to activate you stolen-time logic. Won't you end up
incorrectly accounting the accumulated short time periods?

This is true.  I'm not sure we'd want to get the vcpu info
at every timer interrupt though, that could end up being
too expensive...

Having to call down to Xen to get that information is unfortunate. Perhaps we can export it in shared_info, or have the guest register a virtual address it would like the info written to.

In the tests I ran the steal time seemed to work out quite
well with what I expected it to be, watching /proc/stat from
inside the guest and xentop from dom0 simultaneously.

The rounding errors happen occasionally (I added printks to
the if statements catching them), but not all that often...

I think the calculation of delta stolen time would be clearer as:
((system_time - prev_system_time) - (vcpu_time - prev_vcpu_time)) / NS_PER_TICK where system_time/vcpu_time become the prev_system_time/prev_vcpu_time the next time your logic is triggered.

It has another advantage that it does not subtract quantities that can slowly relatively drift over days/weeks.

 -- Keir

Xen-devel mailing list