kernel/time/timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Only read the cached wheel index when the timer is still queued.
No functional change.
Signed-off-by: Liang Hao <haohlliang@gmail.com>
---
kernel/time/timer.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index ae9abf14688e..9f3b199d3075 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -897,11 +897,13 @@ static inline void detach_timer(struct timer_list *timer, bool clear_pending)
static int detach_if_pending(struct timer_list *timer, struct timer_base *base,
bool clear_pending)
{
- unsigned idx = timer_get_idx(timer);
+ unsigned int idx;
if (!timer_pending(timer))
return 0;
+ idx = timer_get_idx(timer);
+
if (hlist_is_singular_node(&timer->entry, base->vectors + idx)) {
__clear_bit(idx, base->pending_map);
base->next_expiry_recalc = true;
--
2.50.1 (Apple Git-155)
On Fri, Aug 28 2026 at 22:53, Liang Hao wrote: > Only read the cached wheel index when the timer is still queued. > No functional change. Which problem is actually solved by this?
On Sat, Sep 05 2026 at 22:35, Thomas Gleixner wrote: > Which problem is actually solved by this? None that shows up as a bug. The index is never used when the timer is not queued; I only reordered the checks. I'll drop it. Thanks, Liang Hao
© 2016 - 2026 Red Hat, Inc.