[Devel] [PATCH rh7] ve: Add interface for @start_timespec and @real_start_timespec adjustmen

Andrey Vagin avagin at virtuozzo.com
Wed Feb 10 10:02:39 PST 2016


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?
> This looks weird to me. Wouldn't it be better if we returned the
> timespec as is?
>

The idea is that we can read the content of these files and write them back
on the another host to restore "a time namespace".


More information about the Devel mailing list