Re: [patch] jiffies wraparound [Re: 2.1.125 Show stopper list: Draft]

Finn Arne Gangstad (finnag@guardian.no)
Mon, 19 Oct 1998 17:21:07 +0200 (MEST)


On Mon, 19 Oct 1998, Andrea Arcangeli wrote:

> On Sun, 18 Oct 1998, MOLNAR Ingo wrote:
>
> >new implementation gets rid of the per-task timer and per-task timeout
> >value. This effectively puts both of them onto the stack and thus probably
> >improves performance even in the timeout case. And for the common
>
> For some reason I am not sure if removing the timeout from the stack is
> been a good idea.
>
> My kernel is just running without tsk->timeout and using
> schedule_timeout() though. I can' t produce a patch right now because I
> need to clean tons of garbage and to do that I have to review all the
> patch (if you want the patch with the garbage ask and I' ll sent to you).
> If I boot with jiffies = 0 everything seems OK. If I boot with jiffies =
> -120*HZ and timer_jiffies = -120*HZ the timer code became messy (before
> and after the jiffies wrap). I don' t understand at all yet the details of
> the timer code, but it seems that I can' t choose a random jiffies value
> to start (I am complelty wrong on this?).

You have to initialise tv1.index .. tv5.index to the correct values if
you start with timer_jiffies != 0;

This probably means (I haven't thought about this a lot, but you can
always write a simulation with just the ++timer_jiffies & cascade_timers
code to check that the values are always correct. You are interested in
setting the same values that are set on entry to run_timer_list)

tv1.index = timer_jiffies & TVR_MASK;
tv2.index = ((timer_jiffies + TVR_MASK) >> TVR_BITS) & TVN_MASK;
tv3.index = (((timer_jiffies >> TVR_BITS) + TVN_MASK) >> TVN_BITS) &
TVN_MASK;
tv4.index = (((timer_jiffies >> (TVR_BITS + TVN_BITS) + TVN_MASK) >>
TVN_BITS) & TVN_MASK);
tv5.index = (((timer_jiffies >> (TVR_BITS + 2 * TVN_BITS) + TVN_MASK) >>
TVN_BITS) & TVN_MASK);

The timer code could be written to not use the index numebers at all, they
all possible to calculate from timer_jiffies were they are used.

- Finn Arne

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