Re: [Devel] [PATCH rh8 2/3] ve/time/stat: idle time virtualization in /proc/loadavg

2020-10-30 Thread Andrey Ryabinin



On 10/30/20 4:08 PM, Konstantin Khorenko wrote:
> 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 
> ---
Reviewed-by: Andrey Ryabinin 
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH rh8 2/3] ve/time/stat: idle time virtualization in /proc/loadavg

2020-10-30 Thread Konstantin Khorenko
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 
---
 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, );
-   *idle = ns_to_timespec(kstat.cpustat[CPUTIME_IDLE]);
-#endif
+   ve_get_cpu_stat(ve, );
+   *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();
-   else {
+   if (ve_is_super(ve))
get_ve0_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(, task_cgroup(current, cpu_cgroup_subsys_id));
-   rcu_read_unlock();
-#endif
-   }
+   else
+   get_veX_idle(ve, );
 
get_monotonic_boottime();
 #ifdef CONFIG_VE
-- 
2.28.0

___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel