mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@parallels.com>
To: <linux-kernel@vger.kernel.org>
Cc: <cgroups@vger.kernel.org>, <devel@openvz.org>,
	Paul Turner <pjt@google.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Tejun Heo <tj@kernel.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	handai.szj@gmail.com, Andrew.Phillips@lmax.com,
	Serge Hallyn <serge.hallyn@canonical.com>,
	Glauber Costa <glommer@parallels.com>
Subject: [PATCH v3 2/6] account guest time per-cgroup as well.
Date: Wed, 30 May 2012 13:48:33 +0400	[thread overview]
Message-ID: <1338371317-5980-3-git-send-email-glommer@parallels.com> (raw)
In-Reply-To: <1338371317-5980-1-git-send-email-glommer@parallels.com>

We already track multiple tick statistics per-cgroup, using
the task_group_account_field facility. This patch accounts
guest_time in that manner as well.

Signed-off-by: Glauber Costa <glommer@parallels.com>
CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Paul Turner <pjt@google.com>
---
 kernel/sched/core.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 39eb601..220d416 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2717,8 +2717,6 @@ void account_user_time(struct task_struct *p, cputime_t cputime,
 static void account_guest_time(struct task_struct *p, cputime_t cputime,
 			       cputime_t cputime_scaled)
 {
-	u64 *cpustat = kcpustat_this_cpu->cpustat;
-
 	/* Add guest time to process. */
 	p->utime += cputime;
 	p->utimescaled += cputime_scaled;
@@ -2727,11 +2725,11 @@ static void account_guest_time(struct task_struct *p, cputime_t cputime,
 
 	/* Add guest time to cpustat. */
 	if (TASK_NICE(p) > 0) {
-		cpustat[CPUTIME_NICE] += (__force u64) cputime;
-		cpustat[CPUTIME_GUEST_NICE] += (__force u64) cputime;
+		task_group_account_field(p, CPUTIME_NICE, (__force u64) cputime);
+		task_group_account_field(p, CPUTIME_GUEST, (__force u64) cputime);
 	} else {
-		cpustat[CPUTIME_USER] += (__force u64) cputime;
-		cpustat[CPUTIME_GUEST] += (__force u64) cputime;
+		task_group_account_field(p, CPUTIME_USER, (__force u64) cputime);
+		task_group_account_field(p, CPUTIME_GUEST, (__force u64) cputime);
 	}
 }
 
-- 
1.7.10.2


  parent reply	other threads:[~2012-05-30  9:51 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30  9:48 [PATCH v3 0/6] per cgroup /proc/stat statistics Glauber Costa
2012-05-30  9:48 ` [PATCH v3 1/6] measure exec_clock for rt sched entities Glauber Costa
2012-05-30 10:29   ` Peter Zijlstra
2012-05-30 10:32     ` Glauber Costa
2012-05-30 10:42       ` Peter Zijlstra
2012-05-30 10:42         ` Glauber Costa
2012-05-30 11:00           ` Paul Turner
2012-05-30 12:09             ` Glauber Costa
2012-05-30  9:48 ` Glauber Costa [this message]
2012-05-30 10:32   ` [PATCH v3 2/6] account guest time per-cgroup as well Peter Zijlstra
2012-05-30 10:36     ` Glauber Costa
2012-05-30 10:46       ` Paul Turner
2012-05-30  9:48 ` [PATCH v3 3/6] expose fine-grained per-cpu data for cpuacct stats Glauber Costa
2012-05-30 10:34   ` Peter Zijlstra
2012-05-30 10:34     ` Glauber Costa
2012-05-30 10:43       ` Peter Zijlstra
2012-05-30 10:44         ` Glauber Costa
2012-05-30 11:24           ` Peter Zijlstra
2012-05-30 11:24   ` Paul Turner
2012-05-30 12:20     ` Glauber Costa
2012-05-30 12:48       ` Paul Turner
2012-05-30 12:52         ` Glauber Costa
2012-05-30 13:26         ` Glauber Costa
2012-05-30 13:26         ` Glauber Costa
2012-05-30  9:48 ` [PATCH v3 4/6] add a new scheduler hook for context switch Glauber Costa
2012-05-30 11:20   ` Peter Zijlstra
2012-05-30 11:40     ` Peter Zijlstra
2012-05-30 12:08       ` Glauber Costa
2012-05-30 12:07     ` Glauber Costa
2012-05-30  9:48 ` [PATCH v3 5/6] Also record sleep start for a task group Glauber Costa
2012-05-30 11:35   ` Paul Turner
2012-05-30 12:24     ` Glauber Costa
2012-05-30 12:44       ` Peter Zijlstra
2012-05-30 12:44         ` Glauber Costa
2012-05-30  9:48 ` [PATCH v3 6/6] expose per-taskgroup schedstats in cgroup Glauber Costa
2012-05-30 11:22   ` Peter Zijlstra

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=1338371317-5980-3-git-send-email-glommer@parallels.com \
    --to=glommer@parallels.com \
    --cc=Andrew.Phillips@lmax.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=cgroups@vger.kernel.org \
    --cc=devel@openvz.org \
    --cc=ebiederm@xmission.com \
    --cc=handai.szj@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pjt@google.com \
    --cc=serge.hallyn@canonical.com \
    --cc=tj@kernel.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

all inboxes | Powered by JetHome®