lkml.org 
[lkml]   [2011]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/9] Include guest fields in cpuacct
Date
Signed-off-by: Glauber Costa <glommer@parallels.com>
---
kernel/sched.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index a36d995..f0309a0 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1450,6 +1450,8 @@ enum cpuacct_stat_index {
CPUACCT_STAT_SYSTEM, /* ... kernel mode */
CPUACCT_STAT_IRQ, /* ... irq ticks */
CPUACCT_STAT_SOFTIRQ, /* ... softirq ticks */
+ CPUACCT_STAT_GUEST, /* ... guest mode */
+ CPUACCT_STAT_GUEST_NICE, /* ... guest nice */

CPUACCT_STAT_NSTATS,
};
@@ -3793,6 +3795,8 @@ static void account_guest_time(struct task_struct *p, cputime_t cputime,
{
cputime64_t tmp;
struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+ int stat = CPUACCT_STAT_NICE;
+ int statnice = CPUACCT_STAT_GUEST_NICE;

tmp = cputime_to_cputime64(cputime);

@@ -3809,7 +3813,12 @@ static void account_guest_time(struct task_struct *p, cputime_t cputime,
} else {
cpustat->user = cputime64_add(cpustat->user, tmp);
cpustat->guest = cputime64_add(cpustat->guest, tmp);
+ stat = CPUACCT_STAT_USER;
+ statnice = CPUACCT_STAT_GUEST;
}
+
+ cpuacct_update_stats(p, stat, tmp);
+ cpuacct_update_stats(p, statnice, tmp);
}

/*
--
1.7.6


\
 
 \ /
  Last update: 2011-09-14 22:09    [W:0.158 / U:8.836 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site