Commit aae55e9f authored by Anna-Maria Behnsen's avatar Anna-Maria Behnsen Committed by Thomas Gleixner

timers: Make sure TIMER_PINNED flag is set in add_timer_on()

When adding a timer to the timer wheel using add_timer_on(), it is an
implicitly pinned timer. With the timer pull at expiry time model in place,
the TIMER_PINNED flag is required to make sure timers end up in proper
base.

Set the TIMER_PINNED flag unconditionally when add_timer_on() is executed.
Signed-off-by: default avatarAnna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Link: https://lore.kernel.org/r/20240221090548.36600-8-anna-maria@linutronix.de
parent c0e8c5b5
...@@ -1329,7 +1329,10 @@ EXPORT_SYMBOL(add_timer_global); ...@@ -1329,7 +1329,10 @@ EXPORT_SYMBOL(add_timer_global);
* @timer: The timer to be started * @timer: The timer to be started
* @cpu: The CPU to start it on * @cpu: The CPU to start it on
* *
* Same as add_timer() except that it starts the timer on the given CPU. * Same as add_timer() except that it starts the timer on the given CPU and
* the TIMER_PINNED flag is set. When timer shouldn't be a pinned timer in
* the next round, add_timer_global() should be used instead as it unsets
* the TIMER_PINNED flag.
* *
* See add_timer() for further details. * See add_timer() for further details.
*/ */
...@@ -1343,6 +1346,9 @@ void add_timer_on(struct timer_list *timer, int cpu) ...@@ -1343,6 +1346,9 @@ void add_timer_on(struct timer_list *timer, int cpu)
if (WARN_ON_ONCE(timer_pending(timer))) if (WARN_ON_ONCE(timer_pending(timer)))
return; return;
/* Make sure timer flags have TIMER_PINNED flag set */
timer->flags |= TIMER_PINNED;
new_base = get_timer_cpu_base(timer->flags, cpu); new_base = get_timer_cpu_base(timer->flags, cpu);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment