Re: [PATCH 5/6] posix-cpu-timers: Force next expiration recalc after early timer firing

From: Peter Zijlstra
Date: Wed Jun 16 2021 - 09:24:03 EST

On Wed, Jun 16, 2021 at 01:59:23PM +0200, Frederic Weisbecker wrote:
> On Wed, Jun 16, 2021 at 11:42:53AM +0200, Peter Zijlstra wrote:
> > I'm thinking this is a better fix than patch #2. AFAICT you can now go
> > back to unconditionally doing start, and then if we fire it early, we'll
> > disarm the thing.
> >
> > That would avoid the disconnect between the start condition and the fire
> > condition.
> Right but the drawback is that we unconditionally start the threadgroup
> counter while initializing the timer to 0 (deactivated).
> Then in the next tick at least one thread will need to lock the sighand
> and re-evaluate the whole list.

Yes.. but how common is it to enqueue expired timers? Surely that's an
unlikely corner case. All normal timers will have to suffer one extra
tick and iteration on exit, so I find it hard to justify complexity to
optimize an unlikely case.

I would rather have more obvious code.