Re: [PATCH] group xtime, xtime_lock, wall_to_monotonic, avenrun, calc_load_count fields together in ktimed

Randy Dunlap
2006-12-09T06:07:27Z

On Fri, 8 Dec 2006 21:46:25 -0800 Andrew Morton wrote:

> On Fri, 8 Dec 2006 17:52:09 +0100
> Eric Dumazet <dada1@cosmosbay.com> wrote:

[snip]

> Sounds like you have about three patches there.
>
> <save attachment, read from file, s/^/> />
>
> >
> > -extern struct timespec xtime;
> > -extern struct timespec wall_to_monotonic;
> > -extern seqlock_t xtime_lock;
> > +/*
> > + * define a structure to keep all fields close to each others.
> > + */
> > +struct ktimed_struct {
> > + struct timespec _xtime;
> > + struct timespec wall_to_monotonic;
> > + seqlock_t lock;
> > + unsigned long avenrun[3];
> > + int calc_load_count;
> > +};
>
> crappy name, but I guess it doesn't matter as nobody will use it at this
> stage. But...

ktimedata would be better IMO. somethingd looks like a daemon.

>
> > +extern struct ktimed_struct ktimed;
> > +#define xtime ktimed._xtime
> > +#define wall_to_monotonic ktimed.wall_to_monotonic
> > +#define xtime_lock ktimed.lock
> > +#define avenrun ktimed.avenrun
>
> They'll use these instead.
>
> Frankly, I think we'd be better off removing these macros and, longer-term,
> use
>
> write_seqlock(time_data.xtime_lock);
>
> The approach you have here would be a good transition-period thing.

[snip]

> hm, the patch seems to transform a mess into a mess. I guess it's a messy
> problem.
>
> I agree that aggregating all the time-related things into a struct like
> this makes some sense. As does aggregating them all into a similar-looking
> namespace, but that'd probably be too intrusive - too late for that.

Just curious, is the change measurable (time/performance wise)?
Patch makes sense anyway.

---
~Randy