Re: [RFC][PATCH 5/6] Cleanup hrtimer.c's direct access to wall_to_monotonic

From: Arnd Bergmann
Date: Sat Jun 05 2010 - 06:23:27 EST


On Saturday 05 June 2010, John Stultz wrote:
> do {
> seq = read_seqbegin(&xtime_lock);
> xts = __current_kernel_time();
> - tom = wall_to_monotonic;
> + tom = __get_wall_to_monotonic();
> } while (read_seqretry(&xtime_lock, seq));
>

Would it make sense to also limit the use of xtime_lock to the
timekeeping code? I suppose you could merge the various accessors
(current_kernel_time, get_monotonic_coarse, __current_kernel_time,
__get_wall_to_monotonic) with a single function doing

struct timespec current_kernel_time(struct timespec *tomono)
{
struct timespec now;
unsigned long seq;

do {
seq = read_seqbegin(&xtime_lock);
if (tomono)
wall_to_monotonic;
now = xtime;
} while (read_seqretry(&xtime_lock, seq));

return now;
}

Arnd
--
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/