[lkml]   [2003]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Time precision, adjtime(x) vs. gettimeofday

> The following will prevent adjtime from causing time regression.
> It delays starting the adjtime mechanism for one tick, and
> keeps gettimeofday inside the window.
> Only fixes i386, but changes to other arch would be similar.
> Running a simple clock test program and playing with adjtime demonstrates
> that this fixes the problem (and 2.6.0-test6 is broken).
> But given the fragile nature of the timer code, it should go through some
> more testing before inclusion. Andrew could you put this in the next
> -mm tree?

I like that solution. There is still a possible small issue
in 2.4 but I don't think we need to care about it (see below)

Note about the 2.4 SMP race I talked about, x86 is indeed safe,
as it also uses (jiffies - wall_jiffies) to adjust the offset,
I missed it at first as it's not done from the do_gettimeoffset()
function where I was looking for it.

However, that that means we may apply more than one jiffie to
xtime at once, thus the above workaround would still have a small
hole. But since that happens only with insane interrupt latencies
that I don't expect to see in real life, it's probably a non-issue.

2.6 should always have jiffies and wall_jiffies in perfect sync
as they are manipulated within the same write_lock block.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:49    [W:0.052 / U:8.532 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site