On Tue, Feb 09, 2016 at 01:02:09PM +0300, Vladimir Davydov wrote:
> On Mon, Feb 08, 2016 at 11:32:12AM +0300, Cyrill Gorcunov wrote:
> > +static int ve_ts_read(struct cgroup *cg, struct cftype *cft, struct 
> > seq_file *m)
> > +{
> > +   struct ve_struct *ve = cgroup_ve(cg);
> > +   struct timespec ts, *delta;
> > +
> > +   do_posix_clock_monotonic_gettime(&ts);
> > +   if (cft->private == VE_CF_START_TIMESPEC) {
> > +           delta = &ve->start_timespec;
> > +   } else if (cft->private == VE_CF_REAL_START_TIMESPEC) {
> > +           delta = &ve->real_start_timespec;
> > +           monotonic_to_bootbased(&ts);
> > +   } else {
> > +           delta = &ts;
> > +           memset(&ts, 0, sizeof(ts));
> > +           WARN_ON_ONCE(1);
> > +   }
> > +
> > +   set_normalized_timespec(&ts, ts.tv_sec - delta->tv_sec,
> > +                           ts.tv_nsec - delta->tv_nsec);
> > +   seq_printf(m, "%ld %ld", ts.tv_sec, ts.tv_nsec);
> > +   return 0;
> > +}
> 
> So the output of ve.start_timespec is going to evolve over time, right?

Yes. We take current values then substract the @real_[start_]timespec
and return it. IOW they are just monotonic|boottime clocks.

> This looks weird to me. Wouldn't it be better if we returned the
> timespec as is?

No, we have to account real total_sleep_time the container
has on the node, because when you close the lid the total
sleep time will increse but @real_start_timespec won't
as far as I can say and this gonna be wrong.
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to