The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh8-4.18.0-193.6.3.vz8.4.15 ------> commit de23bc4787594c1a8a989eb7d0ae3159a9e518bc Author: Konstantin Khorenko <khore...@virtuozzo.com> Date: Fri Oct 30 13:37:09 2020 +0300
ve/time/stat: idle time virtualization in /proc/loadavg The patch is based on following vz7 commits: a58fb58bff1c ("Use ve init task's css instead of opening cgroup via vfs") 75fc174adc36 ("sched: Port cpustat related patches") Fixes: a3c4d1d8f383 ("ve/time: Customize VE uptime") TODO: to separate FIXME hunks from a3c4d1d8f383 ("ve/time: Customize VE uptime") and merge them into this commit Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com> Reviewed-by: Andrey Ryabinin <aryabi...@virtuozzo.com> --- fs/proc/uptime.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c index bc07d42ce9f5..dae407953903 100644 --- a/fs/proc/uptime.c +++ b/fs/proc/uptime.c @@ -23,37 +23,24 @@ static inline void get_ve0_idle(struct timespec64 *idle) idle->tv_nsec = rem; } -static inline void get_veX_idle(struct timespec *idle, struct cgroup* cgrp) +static inline void get_veX_idle(struct ve_struct *ve, struct timespec64 *idle) { -#if 0 -FIXME: to be reworked anyway in - "Use ve init task's css instead of opening cgroup via vfs" - struct kernel_cpustat kstat; - cpu_cgroup_get_stat(cgrp, &kstat); - *idle = ns_to_timespec(kstat.cpustat[CPUTIME_IDLE]); -#endif + ve_get_cpu_stat(ve, &kstat); + *idle = ns_to_timespec64(kstat.cpustat[CPUTIME_IDLE]); } static int uptime_proc_show(struct seq_file *m, void *v) { struct timespec uptime, offset; struct timespec64 idle; + struct ve_struct *ve = get_exec_env(); - if (ve_is_super(get_exec_env())) - get_ve0_idle(&idle); - else { + if (ve_is_super(ve)) get_ve0_idle(&idle); -#if 0 -FIXME: to be reworked anyway in - "Use ve init task's css instead of opening cgroup via vfs" - - rcu_read_lock(); - get_veX_idle(&idle, task_cgroup(current, cpu_cgroup_subsys_id)); - rcu_read_unlock(); -#endif - } + else + get_veX_idle(ve, &idle); get_monotonic_boottime(&uptime); #ifdef CONFIG_VE _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel