Re: [RFC][PATCH] new timeofday core subsystem (v.A0)

From: George Anzinger
Date: Wed Sep 08 2004 - 23:38:57 EST


john stultz wrote:
On Wed, 2004-09-08 at 20:14, Christoph Lameter wrote:

On Wed, 8 Sep 2004, john stultz wrote:


Why must we use jiffies to tell when a timer expires? Honestly I'd like
to see xtime and jiffies both disappear, but I'm not very familiar w/
the soft-timer code, so forgive me if I'm misunderstanding.

So instead of calculating delta_jiffies, just mark the timer to expire
at B. Then each interrupt, you use get_fast_timestamp() to decide if now
is greater then B. If so, expire it.

Then we can look at being able to program timer interrupts to occur as
close as possible to the next soft-timer's expiration time.

Would it not be best to have some means to determine the time in
nanoseconds since the epoch and then use that for long waits?


The proposal has get_lowres_timeofday() which does just that, although
for timer stuff, I would guess monotonic_clock() or
get_lowres_timestamp(), which returns the number of (ntp adjusted)
nanoseconds the system has been running, would be better.



One can then calculate the wait time in nanoseconds which may then be
passed to another timer routine which may take the appropriate action
depending on the time frame involved. I.e. for a few hundred nsecs do busy
wait. If longer reschedule and if even longer queue the task on some
event queue that is handled by the timer tick or something else.


I'm not sure about the busy wait bit, but yes, at some point I'd like to
see the timer subsystem use the timeofday subsystem instead of jiffies
for its timekeeping.

Yes, I think this is the way we want to go. Here are the "rubs" I see:

a.) resolution. If you don't put a limit on this you will invite timer storms. Currently, by useing 1/HZ resolution, all timer "line up" on ticks and reduce the interrupt overhead that would occure if we actually tried to give "exactly" what was asked for. This is a matter of math and can be handled (assuming we resist the urge to go shopping :))

b.) For those platforms with repeating timers that can not "hit" our desired resolution (i.e. 1/HZ) there is an additional overhead to program the timer each interrupt. In principle we do this in the HRT patch, but there we only do it for high resolution timers, which we assume are rather rare. It is good to have a low res timer that is also accurate. Even better if we can keep the overhead low by not having to reprogram a timer each tick.

In the ideal world we would have a hardware repeating timer that is reasonably accurate (we might want to correct it every second or so) to generate the low res timing interrupts and a high res timer that we can program quickly for high resolution interrupts.

--
George Anzinger george@xxxxxxxxxx
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml

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