From: Konstantin Khorenko <khore...@virtuozzo.com> It will be shown later in /proc/vestat file.
Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com> Reviewed-by: Andrey Ryabinin <aryabi...@virtuozzo.com> (cherry-picked from vz8 commit 998b123f3c3d ("ve/proc/stat: Introduce CPUTIME_USED field in cpustat statistic")) Signed-off-by: Nikita Yushchenko <nikita.yushche...@virtuozzo.com> --- include/linux/kernel_stat.h | 1 + kernel/sched/cpuacct.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index fb6149076cc5..94f59687e530 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -25,6 +25,7 @@ enum cpu_usage_stat { CPUTIME_IRQ, CPUTIME_IDLE, CPUTIME_IOWAIT, + CPUTIME_USED, CPUTIME_STEAL, CPUTIME_GUEST, CPUTIME_GUEST_NICE, diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 29105ef2f402..9e7da99bb9d3 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c @@ -430,7 +430,7 @@ static void cpu_cgroup_update_stat(struct cgroup_subsys_state *cpu_css, struct sched_entity *se = tg->se[i]; u64 *cpustat = cpuacct_cpustat(cpuacct_css, i)->cpustat; u64 now = cpu_clock(i); - u64 delta, idle, iowait, steal; + u64 delta, idle, iowait, steal, used; /* root_task_group has not sched entities */ if (tg == &root_task_group) @@ -439,6 +439,7 @@ static void cpu_cgroup_update_stat(struct cgroup_subsys_state *cpu_css, iowait = se->statistics.iowait_sum; idle = se->statistics.sum_sleep_runtime; steal = se->statistics.wait_sum; + used = se->sum_exec_runtime; if (idle > iowait) idle -= iowait; @@ -462,6 +463,7 @@ static void cpu_cgroup_update_stat(struct cgroup_subsys_state *cpu_css, cpustat[CPUTIME_IDLE] = max(cpustat[CPUTIME_IDLE], idle); cpustat[CPUTIME_IOWAIT] = max(cpustat[CPUTIME_IOWAIT], iowait); cpustat[CPUTIME_STEAL] = steal; + cpustat[CPUTIME_USED] = used; #endif } @@ -540,6 +542,8 @@ static void fixup_vcpustat_delta(struct kernel_cpustat *cur, cur_idle, target_idle); } + cur->cpustat[CPUTIME_USED] = target_usage; + /* do not show steal time inside ve */ cur->cpustat[CPUTIME_STEAL] = 0; } -- 2.30.2 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel