diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 70742e54927becd3567ae262914ccd425aabbce4..70157ad84626a5ceaaf35959a1538c6077001d28 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c @@ -360,7 +360,8 @@ static void __cpuacct_get_usage_result(struct cpuacct *ca, int cpu, res->steal = se->statistics.wait_sum; else res->steal = 0; - res->guest = res->guest_nice = 0; /* currently always 0 */ + res->guest = kcpustat->cpustat[CPUTIME_GUEST]; + res->guest_nice = kcpustat->cpustat[CPUTIME_GUEST_NICE]; } static int cpuacct_proc_stats_show(struct seq_file *sf, void *v) @@ -392,6 +393,7 @@ static int cpuacct_proc_stats_show(struct seq_file *sf, void *v) softirq += res.softirq; steal += res.steal; guest += res.guest; + guest += res.guest_nice; iowait += res.iowait; idle += res.idle; } @@ -406,6 +408,7 @@ static int cpuacct_proc_stats_show(struct seq_file *sf, void *v) irq += kcpustat->cpustat[CPUTIME_IRQ]; softirq += kcpustat->cpustat[CPUTIME_SOFTIRQ]; guest += kcpustat->cpustat[CPUTIME_GUEST]; + guest += kcpustat->cpustat[CPUTIME_GUEST_NICE]; idle += get_idle_time(cpu); iowait += get_iowait_time(cpu); steal += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL]; diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 54eb9457b21d387c3e960d323222708eb5147421..ad3454dc2cba99b7bb80d94af1277c22f6474628 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -137,8 +137,6 @@ void account_user_time(struct task_struct *p, u64 cputime) */ void account_guest_time(struct task_struct *p, u64 cputime) { - u64 *cpustat = kcpustat_this_cpu->cpustat; - /* Add guest time to process. */ p->utime += cputime; account_group_user_time(p, cputime); @@ -146,11 +144,11 @@ void account_guest_time(struct task_struct *p, u64 cputime) /* Add guest time to cpustat. */ if (task_nice(p) > 0) { - cpustat[CPUTIME_NICE] += cputime; - cpustat[CPUTIME_GUEST_NICE] += cputime; + task_group_account_field(p, CPUTIME_NICE, cputime); + task_group_account_field(p, CPUTIME_GUEST_NICE, cputime); } else { - cpustat[CPUTIME_USER] += cputime; - cpustat[CPUTIME_GUEST] += cputime; + task_group_account_field(p, CPUTIME_USER, cputime); + task_group_account_field(p, CPUTIME_GUEST, cputime); } }