[Devel] [PATCH rh8 7/8] ve/proc/stat: Introduce CPUTIME_USED field in cpustat statistic

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 28 18:57:36 MSK 2020


It will be shown later in /proc/vestat file.

TODO: to be merged wth later patch which introduces /proc/vestat file.

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 include/linux/kernel_stat.h | 1 +
 kernel/sched/cpuacct.c      | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 47b75b4be3d5..5a3851b1d771 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 b1460db447e3..3298228565b1 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -461,6 +461,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
 }
 
@@ -539,6 +540,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.28.0



More information about the Devel mailing list