Re: [PATCH v10 20/20] timers: Always queue timers on the local CPU

Anna-Maria Behnsen
2024-02-01T20:58:41Z

Frederic Weisbecker <frederic@kernel.org> writes:

> Le Mon, Jan 15, 2024 at 03:37:43PM +0100, Anna-Maria Behnsen a écrit :
>> The timer pull model is in place so we can remove the heuristics which try
>> to guess the best target CPU at enqueue/modification time.
>>
>> All non pinned timers are queued on the local CPU in the separate storage
>> and eventually pulled at expiry time to a remote CPU.
>>
>> Originally-by: Richard Cochran (linutronix GmbH) <richardcochran@gmail.com>
>> Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
>
> Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
>
> Just one detail below:
>
>> @@ -590,10 +590,13 @@ trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer)
>>
>> /*
>> * We might have to IPI the remote CPU if the base is idle and the
>> - * timer is not deferrable. If the other CPU is on the way to idle
>> - * then it can't set base->is_idle as we hold the base lock:
>> + * timer is pinned. If it is a non pinned timer, it is only queued
>> + * on the remote CPU, when timer was running during queueing. Then
>> + * everything is handled by remote CPU anyway. If the other CPU is
>> + * on the way to idle then it can't set base->is_idle as we hold
>> + * the base lock:
>> */
>> - if (base->is_idle)
>> + if (base->is_idle && timer->flags & TIMER_PINNED)
>
> Is the TIMER_PINNED test necessary? If base->is_idle, then the timer
> is now guaranteed to be TIMER_PINNED, right?
>

Yes, you are right. Should I drop it? To clarify it, I could add a

WARN_ON_ONCE(!timer->flags & TIMER_PINNED)

instead.

Thanks,

Anna-Maria