lkml.org 
[lkml]   [2011]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 5/7] KVM-GST: KVM Steal time accounting
From
Date
On Mon, 2011-06-13 at 19:31 -0400, Glauber Costa wrote:
> +static inline int touch_steal_time(int is_idle)
> +{
> + u64 steal, st = 0;
> +
> + if (static_branch(&paravirt_steal_enabled)) {
> +
> + steal = paravirt_steal_clock(smp_processor_id());
> +
> + steal -= this_rq()->prev_steal_time;
> + this_rq()->prev_steal_time += steal;

If you move this addition below this test:

> + if (is_idle || (steal < TICK_NSEC))
> + return 0;

that is, right here, then you don't loose tiny steal deltas and
subsequent ticks accumulate their steal time until you really
have a full steal tick to account.

I guess you want something different for the idle case though.

> + while (steal > TICK_NSEC) {

/* really, if we wanted a division we'd have written one */
asm("" : "+rm" (steal));
> + steal -= TICK_NSEC;
> + st++;
> + }
> +
> + account_steal_time(st);
> + return 1;
> + }
> + return 0;
> +}




\
 
 \ /
  Last update: 2011-06-14 12:13    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean