Re: [PATCH v8 08/25] timer: Rework idle logic
From: Thomas Gleixner
Date: Tue Oct 10 2023 - 07:49:00 EST
On Tue, Oct 10 2023 at 13:19, Frederic Weisbecker wrote:
> On Tue, Oct 10, 2023 at 12:15:09AM +0200, Thomas Gleixner wrote:
>> > + base->is_idle = time_after(nextevt, basej + 1);
>>
>> This is wrongly ordered. base->is_idle must be updated _after_
>> evaluating base->timers_pending because the below can change nextevt,
>> no?
>>
>> > + if (base->timers_pending) {
>> > + /* If we missed a tick already, force 0 delta */
>> > + if (time_before(nextevt, basej))
>> > + nextevt = basej;
>> > + expires = basem + (u64)(nextevt - basej) * TICK_NSEC;
>
> I suspect it doesn't matter in pratice: base->is_idle will remain false
> if it's before/equal jiffies.
>
> Still it hurts the eyes so I agree the re-ordering should happen here and
> this will even simplify a bit the next patch.
Right. Anna-Maria just pointed that out to me before, but we are all in
violent agreement that it sucks :)