Re: [PATCH v1] hrtimer: Simplify the logic of __hrtimer_get_next_event
From: Thomas Gleixner
Date: Fri May 16 2025 - 06:51:06 EST
On Fri, May 16 2025 at 15:01, Xavier Xia wrote:
> Currently, __hrtimer_get_next_event makes two separate calls to
> __hrtimer_next_event_base for HRTIMER_ACTIVE_SOFT and HRTIMER_ACTIVE_HARD
> respectively to obtain expires_next. However, __hrtimer_next_event_base is
> capable of traversing all timer types simultaneously by simply controlling
> the active mask. There is no need to distinguish the order of traversal
> between soft and hard timers, as the sole purpose is to find the earliest
> expiration time.
> Therefore, the code can be simplified by reducing the two calls to a single
> invocation of __hrtimer_next_event_base, making the code more
> straightforward and easier to understand.
... and broken
> - cpu_base->softirq_next_timer = NULL;
> - next_timer = cpu_base->softirq_next_timer;
> - cpu_base->next_timer = next_timer;
because you removed the cpu_base::[softirq_]next_timer update logic.
Thanks,
tglx