Re: [PATCH 5/7] time: Shadow cycle_last in timekeeper structure

From: Ingo Molnar
Date: Tue Feb 28 2012 - 03:17:12 EST



* John Stultz <john.stultz@xxxxxxxxxx> wrote:

> @@ -184,7 +186,7 @@ static inline s64 timekeeping_get_ns(void)
> cycle_now = clock->read(clock);
>
> /* calculate the delta since the last update_wall_time: */
> - cycle_delta = (cycle_now - clock->cycle_last) & clock->mask;
> + cycle_delta = (cycle_now - timekeeper.cycle_last) & clock->mask;

Just a general code design observation: the way how the global
'timekeeper' structure is accessed is rather ugly.

The standard method is to pass it in to timekeeping_get_ns()
(and other methods) as a parameter, with the highest level
taking the address via &timekeeping.

That will also make the code shorter and more obvious: the
familar tk->cycle_last pattern instead of the current mixed uses
of timekeeping.cycle_last and tk->cycle_last.

There's many similar patterns throughout this code, they need to
be fixed as well.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/