From mboxrd@z Thu Jan 1 00:00:00 1970 From: Glauber Costa Subject: [PATCH 3/5] account guest time per-cgroup as well. Date: Thu, 2 Feb 2012 18:19:30 +0400 Message-ID: <1328192372-9551-4-git-send-email-glommer@parallels.com> References: <1328192372-9551-1-git-send-email-glommer@parallels.com> Return-path: In-Reply-To: <1328192372-9551-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Peter Zijlstra , Paul Turner , kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org, Balbir Singh , Li Zefan , Tejun Heo , devel-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org, "Eric W. Biederman" , Serge Hallyn , Glauber Costa 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 --- kernel/sched/core.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index fe35316..91ea913 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2734,8 +2734,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; @@ -2744,11 +2742,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.7.4