public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Laurent Vivier <Laurent.Vivier@bull.net>,
	Ingo Molnar <mingo@elte.hu>,
	kvm-devel <kvm-devel@lists.sourceforge.net>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 0/4] Virtual Machine Time Accounting
Date: Tue, 04 Aug 2009 19:33:14 +0200	[thread overview]
Message-ID: <1249407194.4762.28.camel@laptop> (raw)
In-Reply-To: <20090804192924.217930fc@skybase>

On Tue, 2009-08-04 at 19:29 +0200, Martin Schwidefsky wrote:

> > So its going to split user time into user and guest. Does that really
> > make sense? For the host kernel it really is just another user process,
> > no?
> 
> The code (at least in parts) is already upstream. Look at the
> account_guest_time function:
> 
> static void account_guest_time(struct task_struct *p, cputime_t cputime,
>                                cputime_t cputime_scaled)
> {
>         cputime64_t tmp;
>         struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
> 
>         tmp = cputime_to_cputime64(cputime);
> 
>         /* Add guest time to process. */
>         p->utime = cputime_add(p->utime, cputime);
>         p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
>         account_group_user_time(p, cputime);
>         p->gtime = cputime_add(p->gtime, cputime);
> 
>         /* Add guest time to cpustat. */
>         cpustat->user = cputime64_add(cpustat->user, tmp);
>         cpustat->guest = cputime64_add(cpustat->guest, tmp);
> }
> 
> The cpu time for a guest is added to p->utime AND p->gtime. That is
> done not to break existing tools that know nothing about guest time.
> A guest time aware tool can subtract the p->gtime from p->utime to
> get the time spent by the process outside of the guest context.

But why? How a vcpu anything other than yet another userspace process?


  reply	other threads:[~2009-08-04 17:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 13:13 [PATCH 0/4] Virtual Machine Time Accounting Laurent Vivier
2007-08-20 13:41 ` [kvm-devel] " Avi Kivity
2007-08-20 13:43 ` John Stoffel
2007-08-20 14:39   ` Laurent Vivier
2007-08-20 16:13     ` Jeremy Fitzhardinge
2007-08-20 23:30       ` Rusty Russell
2007-08-21 12:54       ` [kvm-devel] " Avi Kivity
2009-08-04 14:16 ` Peter Zijlstra
2009-08-04 15:07   ` Martin Schwidefsky
2009-08-04 16:26     ` Peter Zijlstra
2009-08-04 17:29       ` Martin Schwidefsky
2009-08-04 17:33         ` Peter Zijlstra [this message]
2009-08-04 18:12           ` Martin Schwidefsky
2009-08-04 22:23           ` Jeremy Fitzhardinge

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=1249407194.4762.28.camel@laptop \
    --to=peterz@infradead.org \
    --cc=Laurent.Vivier@bull.net \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=schwidefsky@de.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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